Closed donglinb closed 1 year ago
Version 13 of Slide operator allows components in axes to be negative. I borrowed implementations of shape infer from official ONNX repository. The unit test results is following. But there is still a big issue which requires a significant modification: all the node inputs except the first one must be in graph initializer, otherwise the conversion would fail. This is because the start
, ends
, axes
, steps
are moved to inputs since version 10, in which case the shape of output tensor can only be determined at runtime if these inputs are not provided in graph initializers.
[WARNING] 2022-11-09T10:04:31z src/contrib/custom_op/custom_op.h 27 $NNFUSION_HOME was not set, use /root/.nnfusion.
[WARNING] 2022-11-09T10:04:31z src/contrib/custom_op/custom_op.h 27 $NNFUSION_HOME was not set, use /root/.nnfusion.
Note: Google Test filter = nnfusion_onnx_import.slice_op
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from nnfusion_onnx_import
[ RUN ] nnfusion_onnx_import.slice_op
[INFO] 2022-11-09T10:04:31z src/nnfusion/frontend/onnx_import/onnx.cpp 54 Optimizing ONNX Graph with External Tool (models/pytorch2onnx/ort_run_frozen.py)
[WARNING] 2022-11-09T10:04:31z src/nnfusion/common/util.cpp 47 $NNFUSION_HOME was not set, use /root/.nnfusion.
python3: can't open file '/home/build/test/templates/onnx/ort_run_frozen.py': [Errno 2] No such file or directory
[WARNING] 2022-11-09T10:04:32z src/nnfusion/frontend/onnx_import/onnx.cpp 86 Failed to optimize ONNX Graph with external tool, please check error messages reported by the tool, fallback
[INFO] 2022-11-09T10:04:32z src/nnfusion/frontend/onnx_import/onnx.cpp 40 Import ONNX Graph Size: [228]
[INFO] 2022-11-09T10:04:32z src/nnfusion/frontend/onnx_import/util/graph_convert.cpp 317 Converting Onnx Graph
[INFO] 2022-11-09T10:04:32z src/nnfusion/frontend/onnx_import/util/graph_convert.cpp 519 convert node:
[INFO] 2022-11-09T10:04:32z src/nnfusion/frontend/onnx_import/util/graph_convert.cpp 538 node , output y, shape Shape{1, 2}
[INFO] 2022-11-09T10:04:32z src/nnfusion/frontend/onnx_import/util/graph_convert.cpp 514 convert graph done
[WARNING] 2022-11-09T10:04:32z src/nnfusion/common/util.cpp 47 $NNFUSION_HOME was not set, use /root/.nnfusion.
[ OK ] nnfusion_onnx_import.slice_op (2795 ms)
[----------] 1 test from nnfusion_onnx_import (2795 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (2795 ms total)
[ PASSED ] 1 test.
Optional attributes start and end can be used to compute a slice of the input tensor’s shape in Version 15. Unit test results: