Skip to content

ShapeOptimizer and TransposeOptimizer produces wrong graphs. #1665

@xadupre

Description

@xadupre

Describe the bug

Attached file: a non-optimized graphs where TransposeOptimizer (_slice_handler) and ReshapeOptimizer.

debug_noopt.zip

TransposeOptimizer

It fails at that particular node Transpose:

image

onnxruntime can load the non optimized graph (equal to numpy.fft.fft2(numpy.random.rand(3, 1, 4).astype(numpy.float32), (1, 4)). After optimization, it returns the following error:

FAIL : Node (Ma_MatMul__358) Op (MatMul) [ShapeInferenceError] Incompatible dimensions for matrix multiplication

ReshapeOptimizer

It produces the following error stack:

  File "tensorflow-onnx\tests\test_backend.py", line 179, in _run_test_case
    return self.run_test_case(func, feed_dict, [], output_names_with_port, **kwargs)
  File "tensorflow-onnx\tests\backend_test_base.py", line 403, in run_test_case
    self.assert_shapes_correct(g, self.config.allow_missing_shapes, not self.config.skip_onnx_checker)
  File "tensorflow-onnx\tests\backend_test_base.py", line 326, in assert_shapes_correct
    self.assertTrue(tf2onnx_shape is not None)
  File "lib\unittest\case.py", line 682, in assertTrue
    raise self.failureException(msg)

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
  • Tensorflow Version: 2.5
  • Python version: 3.9
  • Opset 13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions