From ee908eb0aa4ee6a94fcbae45ad6675738222d9fa Mon Sep 17 00:00:00 2001 From: KeDengMS Date: Tue, 24 Nov 2020 14:50:41 -0800 Subject: [PATCH] Symbolic shape inference: fix rank for ConstantOfShape (#5912) --- onnxruntime/python/tools/symbolic_shape_infer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/onnxruntime/python/tools/symbolic_shape_infer.py b/onnxruntime/python/tools/symbolic_shape_infer.py index c567b1fd3e..5fc3669262 100755 --- a/onnxruntime/python/tools/symbolic_shape_infer.py +++ b/onnxruntime/python/tools/symbolic_shape_infer.py @@ -623,7 +623,8 @@ class SymbolicShapeInference: self.sympy_data_[node.output[0]] = np.ones([int(x) for x in sympy_shape], dtype=np.int64) * numpy_helper.to_array(get_attribute(node, 'value', 0)) else: # create new dynamic shape - sympy_shape = self._new_symbolic_shape(self._get_shape_rank(node,0), node) + # note input0 is a 1D vector of shape, the new symbolic shape has the rank of the shape vector length + sympy_shape = self._new_symbolic_shape(self._get_shape(node,0)[0], node) vi.CopyFrom(helper.make_tensor_value_info(node.output[0], vi.type.tensor_type.elem_type,