@@ -33,6 +33,9 @@ public Tensor log(Tensor x, string name = null)
3333 public Tensor erf ( Tensor x , string name = null )
3434 => math_ops . erf ( x , name ) ;
3535
36+ public Tensor sum ( Tensor x , Axis ? axis = null , string name = null )
37+ => math_ops . reduce_sum ( x , axis : axis , name : name ) ;
38+
3639 /// <summary>
3740 ///
3841 /// </summary>
@@ -492,40 +495,21 @@ public Tensor reduce_all(Tensor input_tensor, Axis? axis = null, bool keepdims =
492495 public Tensor reduce_prod ( Tensor input_tensor , Axis ? axis = null , bool keepdims = false , string name = null )
493496 => math_ops . reduce_prod ( input_tensor , axis : axis , keepdims : keepdims , name : name ) ;
494497
495- /// <summary>
496- /// Computes the sum of elements across dimensions of a tensor.
497- /// </summary>
498- /// <param name="input_tensors"></param>
499- /// <param name="axis"></param>
500- /// <param name="keepdims"></param>
501- /// <param name="name"></param>
502- /// <returns></returns>
503- public Tensor reduce_sum ( Tensor [ ] input_tensors , int ? axis = null , bool keepdims = false , string name = null )
504- => math_ops . reduce_sum ( input_tensors , axis : axis , keepdims : keepdims , name : name ) ;
505-
506498 /// <summary>
507499 /// Computes the sum of elements across dimensions of a tensor.
508500 /// </summary>
509501 /// <param name="input"></param>
510502 /// <param name="axis"></param>
511503 /// <returns></returns>
512- public Tensor reduce_sum ( Tensor input , int ? axis = null , int ? reduction_indices = null ,
504+ public Tensor reduce_sum ( Tensor input , Axis ? axis = null , Axis ? reduction_indices = null ,
513505 bool keepdims = false , string name = null )
514506 {
515- if ( ! axis . HasValue && reduction_indices . HasValue && ! keepdims )
516- return math_ops . reduce_sum ( input , reduction_indices . Value ) ;
517- else if ( axis . HasValue && ! reduction_indices . HasValue && ! keepdims )
518- return math_ops . reduce_sum ( input , axis . Value ) ;
519- else if ( axis . HasValue && ! reduction_indices . HasValue && keepdims )
520- return math_ops . reduce_sum ( input , keepdims : keepdims , axis : axis . Value , name : name ) ;
507+ if ( keepdims )
508+ return math_ops . reduce_sum ( input , axis : constant_op . constant ( axis ?? reduction_indices ) , keepdims : keepdims , name : name ) ;
521509 else
522- return math_ops . reduce_sum ( input , keepdims : keepdims , name : name ) ;
510+ return math_ops . reduce_sum ( input , axis : constant_op . constant ( axis ?? reduction_indices ) ) ;
523511 }
524512
525- public Tensor reduce_sum ( Tensor input , Shape axis , int ? reduction_indices = null ,
526- bool keepdims = false , string name = null )
527- => math_ops . reduce_sum ( input , axis , keepdims : keepdims , name : name ) ;
528-
529513 /// <summary>
530514 /// Computes the maximum of elements across dimensions of a tensor.
531515 /// </summary>
0 commit comments