forked from llvm/torch-mlir
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
onnx: fix checks for
axes
and steps
inputs of Slice operator
The ONNX Spec for the Slice operator allows the `starts` and `ends` inputs to have fewer indices that the dimensions of the `data` tensor (see https://onnx.ai/onnx/operators/onnx__Slice.html), but our code expects these inputs to be as many as the `data` tensor's dimensions. More precisely, the spec requires that the `starts` and `ends` inputs are only as long as the `axes` input, but since the `axes` input is optional, the default type for the `axes` input has to match the type for the `starts` and `ends` inputs. Moreover, the number of indices in the `steps` input also has to match those in the `axes` inputs (instad of matching the dimensions of the `data` input). This patch fixes the checks in the TorchOnnxToTorch conversion so that they match the ONNX spec.
- Loading branch information
Showing
2 changed files
with
32 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters