@@ -141,16 +141,13 @@ public static Tensor mean<T1, T2>(T1 input, T2 axis, bool keep_dims= false, stri
141141 input as EagerTensor ,
142142 axis as EagerTensor
143143 } , 2 ,
144- op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ] { "keep_dims" , keep_dims } , 0 , status ) ,
144+ op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ] { "keep_dims" , keep_dims } , status ) ,
145145 status ) ;
146146 status . Check ( true ) ;
147147 return new EagerTensor ( tensor ) ;
148148 }
149149 catch ( Exception )
150150 {
151- /*tensors = c_api.TFE_Execute(tf.context, tf.context.device_name, op_name,
152- inputs, attrs, num_outputs);*/
153-
154151 return mean_eager_fallback ( input as Tensor [ ] , axis as Tensor , keep_dims : keep_dims , name : name , ctx : tf . context ) ;
155152 }
156153 }
@@ -167,7 +164,7 @@ private static Tensor mean_eager_fallback(Tensor[] inputs, Tensor axis, bool kee
167164 var _inputs_flat = input . concat ( axis1 ) ;
168165 var _attrs = new object [ ] { "keep_dims" , keep_dims , "T" , _attr_T , "Tidx" , _attr_Tidx } ;
169166
170- return _execute . execute ( ctx , "Mean" , _inputs_flat , _attrs , name : name ) ;
167+ return _execute . execute ( ctx , "Mean" , 1 , _inputs_flat , _attrs , name : name ) ;
171168 }
172169
173170 public static Tensor prod < T1 , T2 > ( T1 input , T2 axis , bool keep_dims = false , string name = null )
@@ -198,7 +195,7 @@ private static Tensor prod_eager_fallback(Tensor input_t, int[] axis, bool keep_
198195 var _inputs_flat = input . concat ( axis1 ) ;
199196 var _attrs = new object [ ] { "keep_dims" , keep_dims , "T" , _attr_T , "Tidx" , _attr_Tidx } ;
200197
201- return _execute . execute ( ctx , "Prod" , _inputs_flat , _attrs , name : name ) ;
198+ return _execute . execute ( ctx , "Prod" , 1 , _inputs_flat , _attrs , name : name ) ;
202199 }
203200
204201 public static Tensor acos ( Tensor x , string name = null )
@@ -599,7 +596,7 @@ public static Tensor cast(Tensor x, TF_DataType DstT, bool Truncate= false, stri
599596 var tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
600597 "Cast" , name ,
601598 new IntPtr [ ] { x as EagerTensor } , 1 ,
602- op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ] { "DstT" , DstT , "Truncate" , Truncate } , 0 , status ) ,
599+ op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ] { "DstT" , DstT , "Truncate" , Truncate } , status ) ,
603600 status ) ;
604601 status . Check ( true ) ;
605602 return new EagerTensor ( tensor ) ;
@@ -836,10 +833,24 @@ public static Tensor mat_mul(Tensor a, Tensor b, bool transpose_a = false, bool
836833 {
837834 if ( tf . context . executing_eagerly ( ) )
838835 {
839- var _result = wrap_tfe_src . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
840- "MatMul" , name , null ,
841- a , b , "transpose_a" , transpose_a , "transpose_b" , transpose_b ) ;
842- return _result ;
836+ using var status = new Status ( ) ;
837+ var tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
838+ "MatMul" , name ,
839+ new IntPtr [ ]
840+ {
841+ a as EagerTensor ,
842+ b as EagerTensor
843+ } , 2 ,
844+ op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ]
845+ {
846+ "transpose_a" ,
847+ transpose_a ,
848+ "transpose_b" ,
849+ transpose_b
850+ } , status ) ,
851+ status ) ;
852+ status . Check ( true ) ;
853+ return new EagerTensor ( tensor ) ;
843854 }
844855
845856 var _op = _op_def_lib . _apply_op_helper ( "MatMul" , name , args : new { a , b , transpose_a , transpose_b } ) ;
@@ -944,10 +955,18 @@ public static Tensor _sum<Tx, Ty>(Tx input, Ty axis = default, bool keep_dims =
944955 {
945956 try
946957 {
947- var _result = wrap_tfe_src . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
948- "Sum" , name , null ,
949- input , axis , "keep_dims" , keep_dims ) ;
950- return _result ;
958+ using var status = new Status ( ) ;
959+ var tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
960+ "Sum" , name ,
961+ new IntPtr [ ]
962+ {
963+ input as EagerTensor ,
964+ axis as EagerTensor
965+ } , 2 ,
966+ op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ] { "keep_dims" , keep_dims } , status ) ,
967+ status ) ;
968+ status . Check ( true ) ;
969+ return new EagerTensor ( tensor ) ;
951970 }
952971 catch ( Exception )
953972 {
@@ -968,7 +987,7 @@ private static Tensor _sum_eager_fallback(Tensor[] inputs, Tensor axis, bool kee
968987 var _inputs_flat = input . concat ( axis1 ) ;
969988 var _attrs = new object [ ] { "keep_dims" , keep_dims , "T" , _attr_T , "Tidx" , _attr_Tidx } ;
970989
971- return _execute . execute ( ctx , "Sum" , _inputs_flat , _attrs , name : name ) ;
990+ return _execute . execute ( ctx , "Sum" , 1 , _inputs_flat , _attrs , name : name ) ;
972991 }
973992
974993 /// <summary>
0 commit comments