@@ -554,62 +554,3 @@ def build_convtranspose_conv_residual_model():
554554 onnx .checker .check_model (model_inferred )
555555
556556 return model_inferred
557-
558-
559- def build_matmul_relu_model (ir_version = 12 ):
560- # Define your model inputs and outputs
561- input_names = ["input_0" ]
562- output_names = ["output_0" ]
563- input_shapes = [(1 , 1024 , 1024 )]
564- output_shapes = [(1 , 1024 , 16 )]
565-
566- inputs = [
567- helper .make_tensor_value_info (input_name , onnx .TensorProto .FLOAT , input_shape )
568- for input_name , input_shape in zip (input_names , input_shapes )
569- ]
570- outputs = [
571- helper .make_tensor_value_info (output_name , onnx .TensorProto .FLOAT , output_shape )
572- for output_name , output_shape in zip (output_names , output_shapes )
573- ]
574-
575- # Create the ONNX graph with the nodes
576- nodes = [
577- helper .make_node (
578- op_type = "MatMul" ,
579- inputs = ["input_0" , "weights_1" ],
580- outputs = ["matmul1_matmul/MatMul:0" ],
581- name = "matmul1_matmul/MatMul" ,
582- ),
583- helper .make_node (
584- op_type = "Relu" ,
585- inputs = ["matmul1_matmul/MatMul:0" ],
586- outputs = ["output_0" ],
587- name = "relu1_relu/Relu" ,
588- ),
589- ]
590-
591- # Create the ONNX initializers
592- initializers = [
593- helper .make_tensor (
594- name = "weights_1" ,
595- data_type = onnx .TensorProto .FLOAT ,
596- dims = (1024 , 16 ),
597- vals = np .random .uniform (low = 0.5 , high = 1.0 , size = 1024 * 16 ),
598- ),
599- ]
600-
601- # Create the ONNX graph with the nodes and initializers
602- graph = helper .make_graph (
603- nodes , f"matmul_relu_ir_{ ir_version } " , inputs , outputs , initializer = initializers
604- )
605-
606- # Create the ONNX model
607- model = helper .make_model (graph )
608- model .opset_import [0 ].version = 13
609- model .ir_version = ir_version
610-
611- # Check the ONNX model
612- model_inferred = onnx .shape_inference .infer_shapes (model )
613- onnx .checker .check_model (model_inferred )
614-
615- return model_inferred
0 commit comments