docstr: Check that the model inference infers the expected shapes for outputs.
  Restricted to the simple case of tensor type outputs with completely
  known shapes.
docstr_tok: ["Check","that","the","model","inference","infers","the","expected","shapes","for","outputs",".","Restricted","to","the","simple","case","of","tensor","type","outputs","with","completely","known","shapes","."]
code: def _check_shape(
      self, model_text: str, *expected: typing.Sequence[int]
  ):
      """Check that the model inference infers the expected shapes for outputs.
      Restricted to the simple case of tensor type outputs with completely
      known shapes.
      """
      model = onnx.parser.parse_model(model_text)
      inferred = onnx.shape_inference.infer_shapes(
          model, True, True, True
      )
      outputs = inferred.graph.output
      for output, expected_shape in zip(outputs, expected):
          inferred_type = output.type
          self.assertTrue(inferred_type.HasField("tensor_type"))
          tensor_type = inferred_type.tensor_type
          self.assertTrue(tensor_type.HasField("shape"))
          inferred_shape = tensor_type.shape
          self.assertEqual(len(inferred_shape.dim), len(expected_shape))
          for inferred_dim, expected_dim in zip(
              inferred_shape.dim, expected_shape
          ):
              self.assertTrue(inferred_dim.HasField("dim_value"))
              self.assertEqual(inferred_dim.dim_value, expected_dim)
  
file_path: onnx/onnx/test/model_inference_test.py
imports: import typing
  import unittest
  import onnx
  import onnx.parser
  import onnx.shape_inference
label_desc: Use image node_id 9 for calling the TestModelInference obj's underlying member method code with example usage: obj._check_shape(model_text) without return types