File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
src/TensorFlowNET.Core/NumPy
test/TensorFlowNET.UnitTest/Dataset Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -107,9 +107,15 @@ public unsafe static implicit operator double(NDArray nd)
107107 public static implicit operator NDArray ( bool value )
108108 => new NDArray ( value ) ;
109109
110+ public static implicit operator NDArray ( byte value )
111+ => new NDArray ( value ) ;
112+
110113 public static implicit operator NDArray ( int value )
111114 => new NDArray ( value ) ;
112115
116+ public static implicit operator NDArray ( long value )
117+ => new NDArray ( value ) ;
118+
113119 public static implicit operator NDArray ( float value )
114120 => new NDArray ( value ) ;
115121
Original file line number Diff line number Diff line change 22using System ;
33using System . Linq ;
44using static Tensorflow . Binding ;
5+ using static Tensorflow . KerasApi ;
56
67namespace TensorFlowNET . UnitTest . Dataset
78{
@@ -195,5 +196,19 @@ public void Shuffle()
195196
196197 Assert . IsFalse ( allEqual ) ;
197198 }
199+ [ TestMethod ]
200+ public void GetData ( )
201+ {
202+ var vocab_size = 20000 ;
203+ var dataset = keras . datasets . imdb . load_data ( num_words : vocab_size ) ;
204+ var x_train = dataset . Train . Item1 ;
205+ Assert . AreEqual ( x_train . dims [ 0 ] , 25000 ) ;
206+ var y_train = dataset . Train . Item2 ;
207+ Assert . AreEqual ( y_train . dims [ 0 ] , 25000 ) ;
208+ var x_val = dataset . Test . Item1 ;
209+ Assert . AreEqual ( x_val . dims [ 0 ] , 25000 ) ;
210+ var y_val = dataset . Test . Item2 ;
211+ Assert . AreEqual ( y_val . dims [ 0 ] , 25000 ) ;
212+ }
198213 }
199214}
You can’t perform that action at this time.
0 commit comments