File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1304,12 +1304,18 @@ def complex_from_polar(abs, angle):
1304
1304
1305
1305
1306
1306
class Mean (FixedOpCAReduce ):
1307
+ # FIXME: Mean is not a true CAReduce in the PyTensor sense, because it needs to keep
1308
+ # track of the number of elements already reduced in order to work iteratively.
1309
+ # This should subclass a `ReduceOp` which `CAReduce` could also inherit from.
1307
1310
__props__ = ("axis" ,)
1308
1311
nfunc_spec = ("mean" , 1 , 1 )
1309
1312
1310
1313
def __init__ (self , axis = None ):
1311
1314
super ().__init__ (ps .mean , axis )
1312
- assert self .axis is None or len (self .axis ) == 1
1315
+ if not (self .axis is None or len (self .axis ) == 1 ):
1316
+ raise NotImplementedError (
1317
+ "Mean Op only supports axis=None or a single axis. Use `mean` function instead"
1318
+ )
1313
1319
1314
1320
def __str__ (self ):
1315
1321
if self .axis is not None :
You can’t perform that action at this time.
0 commit comments