1010from aesara .graph .rewriting .utils import rewrite_graph
1111from aesara .scalar .basic import constant as scalar_constant
1212from aesara .scalar .basic import int64
13- from aesara .tensor import get_gufunc_signature , get_scalar_constant_value
13+ from aesara .tensor import get_scalar_constant_value
1414from aesara .tensor .basic import atleast_Nd
1515from aesara .tensor .elemwise import DimShuffle
1616from aesara .tensor .exceptions import NotScalarConstantError
@@ -216,7 +216,7 @@ def get_output_info(self, *inputs):
216216 else :
217217 core_inputs .append (input )
218218
219- # remore the core dimension first the then broadcast the rest of the dimension
219+ # remove the core dimension first the then broadcast the rest of the dimension
220220 max_loop_dimension = max (
221221 core_inputs [i ].type .ndim - len (self .signature [0 ][i ])
222222 for i in range (len (core_inputs ))
@@ -239,13 +239,13 @@ def get_output_info(self, *inputs):
239239 )
240240 inputs = broadcasted_inputs
241241
242- # TODO: Correct this
243- out_dtype = inputs [ 0 ]. dtype
242+ shadow = self . op . make_node ( * inputs )
243+ out_dtypes = [ o . type . dtype for o in shadow . outputs ]
244244
245245 bcast_shape , dim_sizes = _parse_input_dimensions (inputs , self .signature [0 ])
246246 output_shapes = _calculate_shapes (bcast_shape , dim_sizes , self .signature [1 ])
247247
248- return out_dtype , output_shapes , inputs
248+ return out_dtypes , output_shapes , inputs
249249
250250 def make_node (self , * inputs ):
251251 num_expected_inps = len (self .signature [0 ])
@@ -254,7 +254,7 @@ def make_node(self, *inputs):
254254 f"Expected { int (num_expected_inps )} inputs, got { len (inputs )} "
255255 )
256256
257- out_dtype , output_shapes , inputs = self .get_output_info (* inputs )
257+ out_dtypes , output_shapes , inputs = self .get_output_info (* inputs )
258258
259259 def safe_const_val (x ):
260260 try :
@@ -263,8 +263,8 @@ def safe_const_val(x):
263263 return None
264264
265265 outputs = [
266- TensorType (out_dtype , shape = tuple (safe_const_val (s ) for s in shp ))()
267- for shp in output_shapes
266+ TensorType (out_dtypes [ i ] , shape = tuple (safe_const_val (s ) for s in output_shapes [ i ] ))()
267+ for i in range ( len ( output_shapes ))
268268 ]
269269 return Apply (self , list (inputs ), outputs )
270270
0 commit comments