Skip to content

Commit 2ca2e71

Browse files
committed
update onnx symbolic shape inference
1 parent 3aa8e57 commit 2ca2e71

File tree

3 files changed

+154
-126
lines changed

3 files changed

+154
-126
lines changed

x2paddle/decoder/onnx_decoder.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,12 @@ def allocate_shapes(self):
346346
#if len(value_info['shape']) == 0 or value_info[
347347
# 'dtype'] is None or 0 in value_info['shape']:
348348
# #TODO add node shape inference
349+
shape = value_info['shape']
350+
for idx in range(len(shape)):
351+
if shape[idx] == 0:
352+
shape[idx] = -1
353+
node.out_shapes.append(shape)
349354
node.dtype = value_info['dtype']
350-
node.out_shapes.append(value_info['shape'])
351355
else:
352356
node.out_shapes.append([])
353357

0 commit comments

Comments
 (0)