4 from onnx
import helper, shape_inference, optimizer
5 from onnx
import numpy_helper
6 from onnx
import AttributeProto, TensorProto, GraphProto
9 X = helper.make_tensor_value_info(
'X', TensorProto.FLOAT, [1, 8])
12 Z = helper.make_tensor_value_info(
'Z', TensorProto.FLOAT, [1, 8])
14 tanh1 = helper.make_node(
20 exp2 = helper.make_node(
26 relu3 = helper.make_node(
32 sigmoid4 = helper.make_node(
39 graph_def = helper.make_graph(
40 nodes=[tanh1, exp2, relu3, sigmoid4],
41 name=
'thxprlsg_model',
46 model_def = helper.make_model(graph_def, producer_name=
'benchmarks')
48 onnx.checker.check_model(model_def)
49 model_def = shape_inference.infer_shapes(model_def)
50 onnx.checker.check_model(model_def)
51 model_def = optimizer.optimize(model_def)
52 onnx.checker.check_model(model_def)
54 onnx.save_model(model_def,
'15_thxprlsg.onnx')