@@ -219,10 +219,19 @@ public static Tensor reduce_mean(Tensor input_tensor, int[] axis = null, bool ke
219219 }
220220 }
221221
222- public static Tensor reduce_mean ( Tensor [ ] input_tensors , int axis , bool keepdims = false , string name = null )
222+ public static Tensor reduce_mean ( Tensor [ ] input_tensors , int ? axis = null , bool keepdims = false , string name = null )
223223 {
224- var m = gen_math_ops . mean ( input_tensors , axis , keepdims , name ) ;
225- return _may_reduce_to_scalar ( keepdims , axis , m ) ;
224+ if ( axis == null )
225+ {
226+ var r = _ReductionDims ( input_tensors , axis ) ;
227+ var m = gen_math_ops . mean ( input_tensors , r , keepdims , name ) ;
228+ return _may_reduce_to_scalar ( keepdims , axis , m ) ;
229+ }
230+ else
231+ {
232+ var m = gen_math_ops . mean ( input_tensors , axis , keepdims , name ) ;
233+ return _may_reduce_to_scalar ( keepdims , axis , m ) ;
234+ }
226235 }
227236
228237 /// <summary>
@@ -492,7 +501,7 @@ private static Tensor _may_reduce_to_scalar(bool keepdims, int[] axis, Tensor ou
492501 return output ;
493502 }
494503
495- private static Tensor _may_reduce_to_scalar ( bool keepdims , int axis , Tensor output )
504+ private static Tensor _may_reduce_to_scalar ( bool keepdims , int ? axis , Tensor output )
496505 {
497506 return output ;
498507 }
@@ -515,6 +524,11 @@ private static int _ReductionDims(Tensor x, int axis)
515524 return axis ;
516525 }
517526
527+ private static Tensor _ReductionDims ( Tensor [ ] x , int ? axis = null , string name = null )
528+ {
529+ return range ( 0 , array_ops . rank ( x ) ) ;
530+ }
531+
518532 private static Tensor _ReductionDims ( Tensor x , int [ ] axis )
519533 {
520534 if ( axis != null )
0 commit comments