Skip to content

Possible rounding issue in AveragePooling2DLayer #111

@serenegrace

Description

@serenegrace

Upon attempting to write a test for AveragePooling2DLayer, I have encountered the following flaw:

inputVol(:, :, 1) = [0 0 2 0 0; 1 2 0 2 0; 0 0 2 2 0; 0 2 2 2 2; 2 2 2 1 1]; % channel 1 input matrix
L = AveragePooling2DLayer([3 3], [2 2], [0 0 0 0]);
y = L.evaluate(inputVol);
a=y(1, 1, 1);
b=sum(inputVol(1:3, 1:3, 1), 'all')/9;
The values are extremely close, but not actually the same. Notably, a9=6.9999999 (etc), while b9=7.

I suspect that this level of precision is not relevant usually, but I thought I should mention it all the same

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions