create_model_proto()

audonnx.testing.create_model_proto(shapes, *, dtype=1, opset_version=14, ir_version=7)[source]

Create test ONNX proto object.

Creates an identity graph with input and output nodes of the given shapes. For each entry an input and output node will be created. -1, None or strings define a dynamic axis. Per node, one dynamic axis is allowed. The identity graph can be used as path argument of audonnx.Model.

Parameters
  • shapes (Sequence[Sequence[int]]) – list with shapes defining the identical input and output nodes of the model graph

  • dtype (int) – data type, see supported data types

  • opset_version (int) – opset version

  • ir_version (int) – ir version

Return type

ModelProto

Returns

ONNX object

Examples

>>> create_model_proto([[2]])
ir_version: 7
producer_name: "test"
graph {
  node {
    input: "input-0"
    output: "output-0"
    op_type: "Identity"
  }
  name: "test"
  input {
    name: "input-0"
    type {
      tensor_type {
        elem_type: 1
        shape {
          dim {
            dim_value: 2
          }
        }
      }
    }
  }
  output {
    name: "output-0"
    type {
      tensor_type {
        elem_type: 1
        shape {
          dim {
            dim_value: 2
          }
        }
      }
    }
  }
}
opset_import {
  version: 14
}