INNER CODE UNIT · Python
make_node_test_model
onnx/onnx-tensorrt · onnx_tensorrt/backend.py:202
def make_node_test_model(node, inputs, use_weights=True):
# HACK TODO: The output info is unknown here; not sure what the best solution is
output_dtype = np.float32 # Dummy value only
output_shape = [-99] # Dummy value only
graph_inputs = [onnx_helper.make_tensor_value_info(
name, np2onnx_dtype(array.dtype), array.shape)
for name, array in zip(node.input, inputs)]
graph_outputs = [onnx_helper.make_tensor_value_info(
name, np2onnx_dtype(output_dtype), output_shape)
for name in node.output]
if use_weights:
# Add initializers for all inputs except the first
initializers = [onnx_helper.make_tensor(
name, np2onnx_dtype(array.dtype), array.shape, array.flatten().tolist())
for name, array in zip(node.input[1:], inputs[1:])]
else:
initializers = []
graph = onnx_helper.make_graph(