@@ -138,16 +138,19 @@ public static Tensor mean<T1, T2>(T1 input, T2 axis, bool keep_dims= false, stri
138138 "Mean" , name ,
139139 new IntPtr [ ]
140140 {
141- ( input as EagerTensor ) . EagerTensorHandle ,
142- ( axis as EagerTensor ) . EagerTensorHandle
141+ input as EagerTensor ,
142+ axis as EagerTensor
143143 } , 2 ,
144- ( op ) => wrap_tfe_src . SetOpAttrWithDefaults ( tf . context , op , null , "keep_dims" , keep_dims , null , status ) ,
144+ op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ] { "keep_dims" , keep_dims } , 0 , 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+
151154 return mean_eager_fallback ( input as Tensor [ ] , axis as Tensor , keep_dims : keep_dims , name : name , ctx : tf . context ) ;
152155 }
153156 }
@@ -220,8 +223,8 @@ public static Tensor add(Tensor x, Tensor y, string name = null)
220223 var _result = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
221224 "Add" , name , new IntPtr [ ]
222225 {
223- ( x as EagerTensor ) . EagerTensorHandle ,
224- ( y as EagerTensor ) . EagerTensorHandle
226+ x as EagerTensor ,
227+ y as EagerTensor
225228 } , 2 , null , status ) ;
226229 status . Check ( true ) ;
227230 return new EagerTensor ( _result ) ;
@@ -595,12 +598,8 @@ public static Tensor cast(Tensor x, TF_DataType DstT, bool Truncate= false, stri
595598 using var status = new Status ( ) ;
596599 var tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
597600 "Cast" , name ,
598- new IntPtr [ ] { ( x as EagerTensor ) . EagerTensorHandle } , 1 ,
599- ( op ) =>
600- {
601- wrap_tfe_src . SetOpAttrWithDefaults ( tf . context , op , null , "DstT" , DstT , null , status ) ;
602- wrap_tfe_src . SetOpAttrWithDefaults ( tf . context , op , null , "Truncate" , Truncate , null , status ) ;
603- } ,
601+ new IntPtr [ ] { x as EagerTensor } , 1 ,
602+ op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ] { "DstT" , DstT , "Truncate" , Truncate } , 0 , status ) ,
604603 status ) ;
605604 status . Check ( true ) ;
606605 return new EagerTensor ( tensor ) ;
@@ -649,8 +648,8 @@ public static Tensor sub(Tensor x, Tensor y, string name = null)
649648 var _result = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
650649 "Sub" , name , new IntPtr [ ]
651650 {
652- ( x as EagerTensor ) . EagerTensorHandle ,
653- ( y as EagerTensor ) . EagerTensorHandle
651+ x as EagerTensor ,
652+ y as EagerTensor
654653 } , 2 , null , status ) ;
655654 status . Check ( true ) ;
656655 return new EagerTensor ( _result ) ;
@@ -743,8 +742,8 @@ public static Tensor mul(Tensor x, Tensor y, string name = null)
743742 var _result = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
744743 "Mul" , name , new IntPtr [ ]
745744 {
746- ( x as EagerTensor ) . EagerTensorHandle ,
747- ( y as EagerTensor ) . EagerTensorHandle
745+ x as EagerTensor ,
746+ y as EagerTensor
748747 } , 2 , null , status ) ;
749748 status . Check ( true ) ;
750749 return new EagerTensor ( _result ) ;
@@ -785,8 +784,8 @@ public static Tensor real_div(Tensor x, Tensor y, string name = null)
785784 var _result = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
786785 "RealDiv" , name , new IntPtr [ ]
787786 {
788- ( x as EagerTensor ) . EagerTensorHandle ,
789- ( y as EagerTensor ) . EagerTensorHandle
787+ x as EagerTensor ,
788+ y as EagerTensor
790789 } , 2 , null , status ) ;
791790 status . Check ( true ) ;
792791 return new EagerTensor ( _result ) ;
@@ -988,9 +987,9 @@ public static Tensor range(Tensor start, Tensor limit, Tensor delta, string name
988987 var tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
989988 "Range" , name , new IntPtr [ ]
990989 {
991- ( start as EagerTensor ) . EagerTensorHandle ,
992- ( limit as EagerTensor ) . EagerTensorHandle ,
993- ( delta as EagerTensor ) . EagerTensorHandle
990+ start as EagerTensor ,
991+ limit as EagerTensor ,
992+ delta as EagerTensor
994993 } , 3 , null , status ) ;
995994 status . Check ( true ) ;
996995 return new EagerTensor ( tensor ) ;
0 commit comments