Skip to content

Need clarify the usage of axes=[0,1] for resample2d #624

@BruceDai

Description

@BruceDai

This issue was raised as @fdwr's below comment for reviewing Chromium CL-5382118.

axes=[0,1] is an odd one, and I wonder the history behind it (decided before I joined). Some other ML libraries simply treat axes as numbers (no associated semantics to any particular dimensions), but WebNN limits them to [0,1], [1,2], [2,3]; and while the axes=[1,2] and axes=[2,3] uses are obvious (for NHWC and NCHW tensors respectively), the [0,1] scenario makes me go hmm, because if the semantic interpretation of the input tensor is NHWC, then it would mean resampling the batch and height (but not the width 🙃), which wouldn't make any sense; whereas if the semantic layout of the input was NCHW, then it would mean simultaneously resampling the batch dimension (useful for replication) and expanding the channel count, which can make sense. However, if resampling NC in NCHW is useful, then resampling NC in NHWC should be deemed useful too, but axes=[0,3] is currently disallowed by the spec. 🤔

/cc @fdwr @huningxin @a-sully, PTAL, thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions