onnx / sigs

Repository for ONNX SIG artifacts
Apache License 2.0
19 stars 34 forks source link

How to support and verify dynamic shape and rank in inputs? #20

Open chinhuang007 opened 5 years ago

chinhuang007 commented 5 years ago

ONNX allows a tensor-type to have no shape (which means that even the rank is unknown). A tensor type may have a shape, in which case its rank is known. Each dimension may itself be a statically known constant or unknown. This causes Tensorflow backend converter issues when the conversion logic is based on the input rank or shape. Not sure if this applies to other converters. Would be nice to come up with common solutions.

chinhuang007 commented 4 years ago

The current assumption is the input rank must be known and shape can be unknown. All backend converters should have support and unit tests for unknown input shapes. Since ONNX doesn't provide standard tests, the Tensorflow backend converter team created own tests, https://github.com/onnx/onnx-tensorflow/blob/master/test/backend/test_dynamic_shape.py, as a reference.