@@ -50,51 +50,47 @@ def generate_input2(attrs: list[dict[str, Any]]):
50
50
51
51
for data_layout in ["NCHW" , "NHWC" ]:
52
52
for align_corners in [False , True ]:
53
- for scale_x in [2.0 ]:
54
- scale = [scale_x ]
55
- dics = [
56
- {
57
- "data_layout" : data_layout ,
58
- "interp_method" : "linear" ,
59
- "align_corners" : align_corners ,
60
- "align_mode" : 0 ,
61
- "scale" : scale ,
62
- "out_h" : - 1 ,
63
- "out_w" : - 1 ,
64
- }
65
- ]
66
-
67
- ops_config = [
68
- {
69
- "op_type" : "linear_interp_v2" ,
70
- "op_inputs" : {
71
- "X" : ["input_data" ],
72
- "Scale" : ["input_scale" ],
73
- },
74
- "op_outputs" : {
75
- "Out" : ["linear_interp_v2_output_data" ]
76
- },
77
- "op_attrs" : dics [0 ],
78
- }
79
- ]
80
- ops = self .generate_op_config (ops_config )
81
-
82
- program_config = ProgramConfig (
83
- ops = ops ,
84
- weights = {
85
- "input_scale" : TensorConfig (
86
- data_gen = partial (generate_input2 , dics )
87
- )
53
+ dics = [
54
+ {
55
+ "data_layout" : data_layout ,
56
+ "interp_method" : "linear" ,
57
+ "align_corners" : align_corners ,
58
+ "align_mode" : 0 ,
59
+ "scale" : [],
60
+ "out_h" : - 1 ,
61
+ "out_w" : - 1 ,
62
+ }
63
+ ]
64
+
65
+ ops_config = [
66
+ {
67
+ "op_type" : "linear_interp_v2" ,
68
+ "op_inputs" : {
69
+ "X" : ["input_data" ],
70
+ "Scale" : ["input_scale" ],
88
71
},
89
- inputs = {
90
- "input_data" : TensorConfig (
91
- data_gen = partial (generate_input1 , dics )
92
- )
93
- },
94
- outputs = ["linear_interp_v2_output_data" ],
95
- )
96
-
97
- yield program_config
72
+ "op_outputs" : {"Out" : ["linear_interp_v2_output_data" ]},
73
+ "op_attrs" : dics [0 ],
74
+ }
75
+ ]
76
+ ops = self .generate_op_config (ops_config )
77
+
78
+ program_config = ProgramConfig (
79
+ ops = ops ,
80
+ weights = {
81
+ "input_scale" : TensorConfig (
82
+ data_gen = partial (generate_input2 , dics )
83
+ )
84
+ },
85
+ inputs = {
86
+ "input_data" : TensorConfig (
87
+ data_gen = partial (generate_input1 , dics )
88
+ )
89
+ },
90
+ outputs = ["linear_interp_v2_output_data" ],
91
+ )
92
+
93
+ yield program_config
98
94
99
95
def sample_predictor_configs (
100
96
self , program_config
@@ -124,7 +120,6 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
124
120
attrs , False
125
121
), 1e-5
126
122
self .trt_param .precision = paddle_infer .PrecisionType .Half
127
- program_config .set_input_type (np .float16 )
128
123
yield self .create_inference_config (), generate_trt_nodes_num (
129
124
attrs , False
130
125
), 1e-2
@@ -235,7 +230,6 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
235
230
attrs , False
236
231
), 1e-5
237
232
self .trt_param .precision = paddle_infer .PrecisionType .Half
238
- program_config .set_input_type (np .float16 )
239
233
yield self .create_inference_config (), generate_trt_nodes_num (
240
234
attrs , False
241
235
), 1e-2
0 commit comments