Skip to content

Support reverse operator #773

@huningxin

Description

@huningxin

This operator reverses the order of the input tensor along specified axes. There are some pytorch models using flip operator. When they target WebNN, the flip/reverse operator get fallback to other execution providers and cause performance drop.

Frameworks' support

  • PyTorch flip
  • TensorFlow reverse
  • ONNX Slice support reverse slicing by setting step to -1

Native ML API's support

Proposal

dictionary MLReverseOptions : MLOperatorOptions {
  sequence<[EnforceRange] unsigned long> axes;
};
 
MLOperand reverse(MLOperand input, optional MLReverseOptions options = {});

Discussed with @fdwr offline, Dwayne recommended treating the axes similar to reduce operators. So if not provided at all, then all axes are reversed; but if explicitly passed as empty, then no axes are reversed.

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