@@ -220,6 +220,18 @@ public static Tensor prevent_gradient(Tensor input, string message = "", string
220220 /// <param name="name"></param>
221221 public static Tensor identity ( Tensor input , string name = null )
222222 {
223+ if ( tf . context . executing_eagerly ( ) )
224+ {
225+ using var status = new Status ( ) ;
226+ EagerTensorHandle tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
227+ "Identity" , name , new IntPtr [ ]
228+ {
229+ input as EagerTensor
230+ } , 1 , null , status ) ;
231+ status . Check ( true ) ;
232+ return tensor ;
233+ }
234+
223235 var _op = _op_def_lib . _apply_op_helper ( "Identity" , name , new { input } ) ;
224236
225237 return _op . output ;
@@ -258,14 +270,14 @@ public static Tensor fill<T>(Tensor dims, T value, string name = null)
258270 if ( tf . context . executing_eagerly ( ) )
259271 {
260272 using var status = new Status ( ) ;
261- var tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
273+ EagerTensorHandle tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
262274 "Fill" , name , new IntPtr [ ]
263275 {
264276 dims as EagerTensor ,
265277 value as EagerTensor
266278 } , 2 , null , status ) ;
267279 status . Check ( true ) ;
268- return new EagerTensor ( tensor ) ;
280+ return tensor ;
269281 }
270282
271283 var _op = _op_def_lib . _apply_op_helper ( "Fill" , name , new { dims , value } ) ;
@@ -281,6 +293,18 @@ value as EagerTensor
281293 /// <returns>A tuple of `Tensor` objects (r0, r1).</returns>
282294 public static ( Tensor , Tensor ) broadcast_gradient_args ( Tensor s0 , Tensor s1 , string name = "" )
283295 {
296+ if ( tf . context . executing_eagerly ( ) )
297+ {
298+ using var status = new Status ( ) ;
299+ var _result = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
300+ "BroadcastGradientArgs" , name , new IntPtr [ ]
301+ {
302+ s0 as EagerTensor ,
303+ s1 as EagerTensor
304+ } , 2 , null , status ) ;
305+ status . Check ( true ) ;
306+ }
307+
284308 var _op = _op_def_lib . _apply_op_helper ( "BroadcastGradientArgs" , name , new { s0 , s1 } ) ;
285309
286310 return ( _op . outputs [ 0 ] , _op . outputs [ 1 ] ) ;
@@ -371,10 +395,19 @@ public static Tensor shape(Tensor input, TF_DataType out_type = TF_DataType.TF_I
371395 {
372396 if ( tf . context . executing_eagerly ( ) )
373397 {
374- var _result = wrap_tfe_src . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
375- "Shape" , name , null ,
376- input , "out_type" , out_type ) ;
377- return _result ;
398+ using var status = new Status ( ) ;
399+ EagerTensorHandle tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
400+ "Shape" , name , new IntPtr [ ]
401+ {
402+ input as EagerTensor ,
403+ } , 1 ,
404+ op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ]
405+ {
406+ "out_type" , out_type
407+ } , status ) ,
408+ status ) ;
409+ status . Check ( true ) ;
410+ return tensor ;
378411 }
379412
380413 var _op = _op_def_lib . _apply_op_helper ( "Shape" , name , new { input , out_type } ) ;
@@ -455,12 +488,26 @@ public static Tensor strided_slice(Tensor input, Tensor begin, Tensor end, Tenso
455488 {
456489 if ( tf . context . executing_eagerly ( ) )
457490 {
458- var _result = wrap_tfe_src . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
459- "StridedSlice" , name , null ,
460- input , begin , end , strides , "begin_mask" , begin_mask ,
461- "end_mask" , end_mask , "ellipsis_mask" , ellipsis_mask ,
462- "new_axis_mask" , new_axis_mask , "shrink_axis_mask" , shrink_axis_mask ) ;
463- return _result ;
491+ using var status = new Status ( ) ;
492+ EagerTensorHandle tensor = c_api . TFE_FastPathExecute ( tf . context , tf . context . device_name ,
493+ "StridedSlice" , name , new IntPtr [ ]
494+ {
495+ input as EagerTensor ,
496+ begin as EagerTensor ,
497+ end as EagerTensor ,
498+ strides as EagerTensor ,
499+ } , 4 ,
500+ op => wrap_tfe_src . SetOpAttrs ( tf . context , op , new object [ ]
501+ {
502+ "begin_mask" , begin_mask ,
503+ "end_mask" , end_mask ,
504+ "ellipsis_mask" , ellipsis_mask ,
505+ "new_axis_mask" , new_axis_mask ,
506+ "shrink_axis_mask" , shrink_axis_mask
507+ } , status ) ,
508+ status ) ;
509+ status . Check ( true ) ;
510+ return tensor ;
464511 }
465512
466513 var _op = _op_def_lib . _apply_op_helper ( "StridedSlice" , name , new
0 commit comments