Skip to content

Support strides option for slice operator #772

@huningxin

Description

@huningxin

This is a separate issue of previous discussion #369 (comment) focusing on steps/strides support (proposed by @fdwr, thanks!).

A stride of slice operator indicates how many elements to advance when copying within the input tensor along a dimension. It is widely supported. However, today's WebNN slice operator only support stride 1. We observed there are real models using slice with stride > 1. When targeting those model to WebNN, the slice op has fallback to other execution provider and causes performance drop.

Frameworks' support

Native ML API's support

Proposal

dictionary MLSliceOptions : MLOperatorOptions {
  sequence<[EnforceRange] unsigned long> strides;
};

MLOperand slice(MLOperand input,
                sequence<[EnforceRange] unsigned long> starts,
                sequence<[EnforceRange] unsigned long> sizes,
                optional MLSliceOptions options = {});

Revision History:
10/29/2004: only support positive strides.

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