@@ -7,14 +7,12 @@ namespace Tensorflow.Keras.Engine.DataAdapters
77 /// <summary>
88 /// Adapter that handles Tensor-like objects, e.g. EagerTensor and NumPy.
99 /// </summary>
10- public class TensorLikeDataAdapter : IDataAdapter
10+ public class TensorLikeDataAdapter : DataAdapter , IDataAdapter
1111 {
12- DataAdapterArgs args ;
1312 int _size ;
1413 int _batch_size ;
1514 int num_samples ;
1615 int num_full_batches ;
17- IDatasetV2 _dataset ;
1816
1917 public TensorLikeDataAdapter ( DataAdapterArgs args )
2018 {
@@ -31,7 +29,7 @@ public TensorLikeDataAdapter(DataAdapterArgs args)
3129 indices_dataset = indices_dataset . repeat ( ) ;
3230 indices_dataset = indices_dataset . map ( permutation ) . prefetch ( 1 ) ;
3331 indices_dataset = indices_dataset . flat_map ( slice_batch_indices ) ;
34- _dataset = slice_inputs ( indices_dataset , args . X , args . Y ) ;
32+ dataset = slice_inputs ( indices_dataset , args . X , args . Y ) ;
3533 }
3634
3735 Tensor permutation ( Tensor tensor )
@@ -73,26 +71,11 @@ IDatasetV2 slice_inputs(IDatasetV2 indices_dataset, Tensor x, Tensor y)
7371 return dataset ;
7472 }
7573
76- public bool CanHandle ( Tensor x , Tensor y = null )
77- {
78- throw new NotImplementedException ( ) ;
79- }
80-
81- void _process_tensorlike ( )
82- {
83- }
84-
85- public IDatasetV2 GetDataset ( )
86- => _dataset ;
87-
88- public int GetSize ( )
74+ public override int GetSize ( )
8975 => _size ;
9076
91- public ( Tensor , Tensor ) Expand1d ( Tensor x , Tensor y )
77+ void _process_tensorlike ( )
9278 {
93- if ( y . TensorShape . ndim == 1 )
94- y = array_ops . expand_dims ( y , axis : - 1 ) ;
95- return ( x , y ) ;
9679 }
9780 }
9881}
0 commit comments