@@ -7,7 +7,8 @@ namespace Tensorflow
77{
88 public class array_ops : Python
99 {
10- public static Tensor placeholder_with_default < T > ( T input , int [ ] shape , string name = null ) => gen_array_ops . placeholder_with_default ( input , shape , name ) ;
10+ public static Tensor placeholder_with_default < T > ( T input , int [ ] shape , string name = null )
11+ => gen_array_ops . placeholder_with_default ( input , shape , name ) ;
1112
1213 public static Tensor zeros ( Shape shape , TF_DataType dtype = TF_DataType . TF_FLOAT , string name = null )
1314 {
@@ -111,14 +112,14 @@ public static Tensor _autopacking_helper(object[] list_or_tuple, TF_DataType dty
111112 } ) ;
112113 }
113114
114- public static Tensor expand_dims ( Tensor input , int axis = - 1 , string name = null , int dim = - 1 ) => expand_dims_v2 ( input , axis , name ) ;
115+ public static Tensor expand_dims ( Tensor input , int axis = - 1 , string name = null , int dim = - 1 )
116+ => expand_dims_v2 ( input , axis , name ) ;
115117
116- private static Tensor expand_dims_v2 ( Tensor input , int axis , string name = null ) => gen_array_ops . expand_dims ( input , axis , name ) ;
118+ private static Tensor expand_dims_v2 ( Tensor input , int axis , string name = null )
119+ => gen_array_ops . expand_dims ( input , axis , name ) ;
117120
118121 public static Tensor rank ( Tensor input , string name = null )
119- {
120- return math_ops . rank_internal ( input , name , optimize : true ) ;
121- }
122+ => math_ops . rank_internal ( input , name , optimize : true ) ;
122123
123124 /// <summary>
124125 /// Creates a tensor with all elements set to 1.
@@ -132,9 +133,7 @@ public static Tensor ones_like<T>(T tensor, TF_DataType dtype = TF_DataType.DtIn
132133 => ones_like_impl ( tensor , dtype , name , optimize ) ;
133134
134135 public static Tensor reshape < T1 , T2 > ( T1 tensor , T2 shape , string name = null )
135- {
136- return gen_array_ops . reshape ( tensor , shape , null ) ;
137- }
136+ => gen_array_ops . reshape ( tensor , shape , null ) ;
138137
139138 private static Tensor ones_like_impl < T > ( T tensor , TF_DataType dtype , string name , bool optimize = true )
140139 {
@@ -239,14 +238,10 @@ public static Tensor where(Tensor condition, Tensor x = null, Tensor y = null, s
239238 /// </param>
240239 /// <returns>A `Tensor` of type `out_type`.</returns>
241240 public static Tensor shape ( Tensor input , string name = null , TF_DataType out_type = TF_DataType . TF_INT32 )
242- {
243- return shape_internal ( input , name , optimize : true , out_type : out_type ) ;
244- }
241+ => shape_internal ( input , name , optimize : true , out_type : out_type ) ;
245242
246243 public static Tensor size ( Tensor input , string name = null , bool optimize = true , TF_DataType out_type = TF_DataType . TF_INT32 )
247- {
248- return size_internal ( input , name , optimize : optimize , out_type : out_type ) ;
249- }
244+ => size_internal ( input , name , optimize : optimize , out_type : out_type ) ;
250245
251246 private static Tensor shape_internal ( Tensor input , string name = null , bool optimize = true , TF_DataType out_type = TF_DataType . TF_INT32 )
252247 {
@@ -323,8 +318,46 @@ public static Tensor zeros_like(Tensor tensor, TF_DataType dtype = TF_DataType.D
323318 /// <param name="name"></param>
324319 /// <returns></returns>
325320 public static Tensor stop_gradient ( Tensor input , string name = null )
321+ => gen_array_ops . stop_gradient ( input , name ) ;
322+
323+ /// <summary>
324+ /// Extracts a strided slice of a tensor (generalized python array indexing).
325+ /// </summary>
326+ /// <param name="input_"></param>
327+ /// <param name="begin"></param>
328+ /// <param name="end"></param>
329+ /// <param name="strides"></param>
330+ /// <param name="begin_mask"></param>
331+ /// <param name="end_mask"></param>
332+ /// <param name="ellipsis_mask"></param>
333+ /// <param name="new_axis_mask"></param>
334+ /// <param name="shrink_axis_mask"></param>
335+ /// <param name="name"></param>
336+ /// <returns></returns>
337+ public static Tensor strided_slice ( Tensor input_ , Tensor begin , Tensor end ,
338+ Tensor strides = null ,
339+ int begin_mask = 0 ,
340+ int end_mask = 0 ,
341+ int ellipsis_mask = 0 ,
342+ int new_axis_mask = 0 ,
343+ int shrink_axis_mask = 0 ,
344+ string name = null )
326345 {
327- return gen_array_ops . stop_gradient ( input , name ) ;
346+ var op = gen_array_ops . strided_slice (
347+ input : input_ ,
348+ begin : begin ,
349+ end : end ,
350+ strides : strides ,
351+ begin_mask : begin_mask ,
352+ end_mask : end_mask ,
353+ ellipsis_mask : ellipsis_mask ,
354+ new_axis_mask : new_axis_mask ,
355+ shrink_axis_mask : shrink_axis_mask ,
356+ name : name ) ;
357+
358+ string parent_name = name ;
359+
360+ return op ;
328361 }
329362
330363 /// <summary>
@@ -345,14 +378,14 @@ public static Tensor stop_gradient(Tensor input, string name = null)
345378 /// Contains the same data as `input`, but has one or more dimensions of
346379 /// size 1 removed.</returns>
347380 public static Tensor squeeze ( Tensor input , int [ ] axis = null , string name = null , int [ ] squeeze_dims = null )
348- {
349- return gen_array_ops . squeeze ( input , axis , name ) ;
350- }
381+ => gen_array_ops . squeeze ( input , axis , name ) ;
351382
352383 public static Tensor identity ( Tensor input , string name = null )
353- {
354- return gen_array_ops . identity ( input , name ) ;
355- }
384+ => gen_array_ops . identity ( input , name ) ;
385+
386+ public static Tensor invert_permutation ( Tensor x , string name = null )
387+ => gen_array_ops . invert_permutation ( x , name : name ) ;
388+
356389 /// <summary>
357390 /// Computes the shape of a broadcast given symbolic shapes.
358391 /// When shape_x and shape_y are Tensors representing shapes(i.e.the result of
@@ -368,26 +401,19 @@ public static Tensor identity(Tensor input, string name = null)
368401 /// <param name="shape_y"> A rank 1 integer `Tensor`, representing the shape of y.</param>
369402 /// <returns> A rank 1 integer `Tensor` representing the broadcasted shape.</returns>
370403 public static Tensor broadcast_dynamic_shape ( Tensor shape_x , Tensor shape_y )
371- {
372- return gen_array_ops . broadcast_args ( shape_x , shape_y ) ;
373- }
404+ => gen_array_ops . broadcast_args ( shape_x , shape_y ) ;
374405
375406 public static Tensor broadcast_static_shape ( Tensor shape_x , Tensor shape_y )
376- {
377- return Framework . common_shapes . broadcast_shape ( shape_x , shape_y ) ;
378- }
407+ => Framework . common_shapes . broadcast_shape ( shape_x , shape_y ) ;
379408
380409 public static Tensor gather ( Tensor @params , Tensor indices , string name = null , int axis = 0 )
381- {
382- return gen_array_ops . gather_v2 ( @params , indices , axis , name : name ) ;
383- }
410+ => gen_array_ops . gather_v2 ( @params , indices , axis , name : name ) ;
384411
385- public static Tensor transpose ( Tensor a , int [ ] perm = null , string name = "transpose" , bool conjugate = false )
412+ public static Tensor transpose < T1 , T2 > ( T1 a , T2 perm , string name = "transpose" , bool conjugate = false )
386413 {
387414 return with ( ops . name_scope ( name , "transpose" , new { a } ) , scope =>
388415 {
389- name = scope ;
390- return gen_array_ops . transpose ( a , perm , name ) ;
416+ return gen_array_ops . transpose ( a , perm , name : scope ) ;
391417 } ) ;
392418 }
393419
0 commit comments