@@ -137,7 +137,7 @@ public static Tensor zeros(Tensors shape, TF_DataType dtype = TF_DataType.TF_FLO
137137 if ( shape . Length > 1 )
138138 {
139139 shapeTensor = ops . convert_to_tensor ( shape , dtypes . int32 ) ;
140- if ( shapeTensor . ndim > 1 )
140+ if ( shapeTensor . ndim > 1 )
141141 {
142142 shapeTensor = array_ops . reshape ( shapeTensor , new Shape ( - 1 ) ) ;
143143 }
@@ -304,6 +304,10 @@ public static Tensor _autopacking_helper(IEnumerable<object> list_or_tuple, TF_D
304304 {
305305 elems_as_tensors . Add ( tensor ) ;
306306 }
307+ else if ( elem is KerasTensor kt )
308+ {
309+ elems_as_tensors . Add ( kt ) ;
310+ }
307311 else
308312 {
309313 var elem_tensor = constant_op . constant ( elem , dtype : dtype , name : i . ToString ( ) ) ;
@@ -404,7 +408,10 @@ public static Tensor reshape(Tensor tensor, Shape shape, string name = null)
404408 => gen_array_ops . reshape ( tensor , shape , name : name ) ;
405409
406410 public static Tensor reshape ( Tensor tensor , object [ ] shape , string name = null )
407- => gen_array_ops . reshape ( tensor , ops . convert_to_tensor ( shape ) , name : name ) ;
411+ {
412+ var dims = shape_utils . from_object_array ( shape ) ;
413+ return gen_array_ops . reshape ( tensor , dims , name : name ) ;
414+ }
408415
409416 private static Tensor ones_like_impl < T > ( T tensor , TF_DataType dtype , string name , bool optimize = true )
410417 {
@@ -425,6 +432,10 @@ public static Tensor ones(Tensor shape, TF_DataType dtype = TF_DataType.TF_FLOAT
425432 return tf_with ( ops . name_scope ( name , "ones" , new { shape } ) , scope =>
426433 {
427434 name = scope ;
435+ if ( shape . _shape_tuple ( ) . Length == 0 )
436+ {
437+ shape = reshape ( shape , new Shape ( - 1 ) ) ;
438+ }
428439 var output = gen_array_ops . fill ( shape , constant_op . constant ( 1.0f , dtype : dtype ) , name : name ) ;
429440 return output ;
430441 } ) ;
@@ -647,6 +658,20 @@ public static Tensor tile(Tensor input, Tensor multiples, string name = null)
647658 }
648659 } ) ;
649660
661+ public static Tensor tile ( Tensor input , object [ ] multiples , string name = null )
662+ {
663+ Shape dims = shape_utils . from_object_array ( multiples ) ;
664+
665+ return tf . Context . ExecuteOp ( "Tile" , name , new ExecuteOpArgs ( input , dims )
666+ {
667+ GetGradientAttrs = ( op ) => new
668+ {
669+ T = op . get_attr < TF_DataType > ( "T" ) ,
670+ Tmultiples = op . get_attr < TF_DataType > ( "Tmultiples" )
671+ }
672+ } ) ;
673+ }
674+
650675 public static Tensor zeros_like ( Tensor tensor , TF_DataType dtype = TF_DataType . DtInvalid , string name = null , bool optimize = true )
651676 {
652677 return tf_with ( ops . name_scope ( name , "zeros_like" , new Tensor [ ] { tensor } ) , scope =>
0 commit comments