@@ -161,27 +161,29 @@ def _prepare_input(self, inputs_info):
161
161
rng = np .random .default_rng ()
162
162
assert 'x_real:0' in inputs_info
163
163
assert 'x_imag:0' in inputs_info
164
- x_real_shape = inputs_info ['x_real:0' ]
165
- x_imag_shape = inputs_info ['x_imag:0' ]
164
+ assert 'y_real:0' in inputs_info
165
+ assert 'y_imag:0' in inputs_info
166
+ x_shape = inputs_info ['x_real:0' ]
167
+ y_shape = inputs_info ['y_real:0' ]
166
168
inputs_data = {}
167
- inputs_data ['x_real:0' ] = 4 * rng .random (x_real_shape ).astype (np .float64 ) - 2
168
- inputs_data ['x_imag:0' ] = 4 * rng .random (x_imag_shape ).astype (np .float64 ) - 2
169
+
170
+ inputs_data ['x_real:0' ] = 4 * rng .random (x_shape ).astype (np .float64 ) - 2
171
+ inputs_data ['x_imag:0' ] = 4 * rng .random (x_shape ).astype (np .float64 ) - 2
172
+
173
+ inputs_data ['y_real:0' ] = 4 * rng .random (y_shape ).astype (np .float64 ) - 2
174
+ inputs_data ['y_imag:0' ] = 4 * rng .random (y_shape ).astype (np .float64 ) - 2
175
+
169
176
return inputs_data
170
177
171
- def create_complex_bias_add_net (self , shape , data_format , ir_version , use_legacy_frontend , output_type = tf .float64 ):
178
+ def create_complex_bias_add_net (self , input_shape , bias_shape , data_format , ir_version , use_legacy_frontend , output_type = tf .float64 ):
172
179
tf .compat .v1 .reset_default_graph ()
173
180
174
181
with tf .compat .v1 .Session () as sess :
175
- x_real_shape = shape .copy ()
176
- x_imag_shape = shape .copy ()
177
-
178
- x_real = tf .compat .v1 .placeholder (output_type , x_real_shape , 'x_real' )
179
- x_imag = tf .compat .v1 .placeholder (output_type , x_imag_shape , 'x_imag' )
182
+ x_real = tf .compat .v1 .placeholder (output_type , input_shape , 'x_real' )
183
+ x_imag = tf .compat .v1 .placeholder (output_type , input_shape , 'x_imag' )
180
184
181
- constant_value_real = np .random .randint (- 256 , 256 , x_real_shape [- 1 ]).astype (output_type .as_numpy_dtype ())
182
- constant_value_imag = np .random .randint (- 256 , 256 , x_imag_shape [- 1 ]).astype (output_type .as_numpy_dtype ())
183
- y_real = tf .constant (constant_value_real )
184
- y_imag = tf .constant (constant_value_imag )
185
+ y_real = tf .compat .v1 .placeholder (output_type , bias_shape , 'y_real' )
186
+ y_imag = tf .compat .v1 .placeholder (output_type , bias_shape , 'y_imag' )
185
187
186
188
complex_input = tf .complex (x_real , x_imag )
187
189
complex_bias = tf .complex (y_real , y_imag )
@@ -195,10 +197,10 @@ def create_complex_bias_add_net(self, shape, data_format, ir_version, use_legacy
195
197
return tf_net , None
196
198
197
199
test_data_2D = [
198
- dict (shape = [1 , 1 ], data_format = "NHWC" ),
199
- dict (shape = [1 , 224 ], data_format = "NHWC" ),
200
- dict (shape = [1 , 1 ], data_format = "NCHW" ),
201
- dict (shape = [1 , 224 ], data_format = "NCHW" ),
200
+ dict (shape = [1 , 1 ], bias_shape = [ 1 ], data_format = "NHWC" ),
201
+ dict (shape = [3 , 2 , 7 ], bias_shape = [ 7 ], data_format = "NHWC" ),
202
+ dict (shape = [3 , 2 , 7 , 10 ], bias_shape = [ 2 ], data_format = "NCHW" ),
203
+ dict (shape = [7 , 6 , 4 , 5 ], bias_shape = [ 6 ], data_format = "NCHW" ),
202
204
]
203
205
204
206
@pytest .mark .parametrize ("params" , test_data_2D )
0 commit comments