create_model()

audonnx.testing.create_model(shapes, *, value=0.0, dtype=1, opset_version=14, device='cpu', num_workers=1, session_options=None)[source]

Create test model.

Creates a model that outputs arrays filled with value of the given shapes. For each entry an output node will be created. -1, None or strings define a dynamic axis. Per node, one dynamic axis is allowed.

Parameters
Return type

Model

Returns

model object

Examples

>>> shapes = [[3], [1, -1, 2]]
>>> model = create_model(shapes)
>>> model
Input:
  input-0:
    shape: [3]
    dtype: tensor(float)
    transform: audonnx.core.function.Function(reshape)
  input-1:
    shape: [1, -1, 2]
    dtype: tensor(float)
    transform: audonnx.core.function.Function(reshape)
Output:
  output-0:
    shape: [3]
    dtype: tensor(float)
    labels: [output-0-0, output-0-1, output-0-2]
  output-1:
    shape: [1, -1, 2]
    dtype: tensor(float)
    labels: [output-1-0, output-1-1]
>>> signal = np.zeros((1, 5), np.float32)
>>> model(signal, 8000)
{'output-0': array([0., 0., 0.], dtype=float32), 'output-1': array([[[0., 0.],
        [0., 0.],
        [0., 0.],
        [0., 0.],
        [0., 0.]]], dtype=float32)}