examples/api-examples/initializer_example.rb in ruby-dnn-0.15.1 vs examples/api-examples/initializer_example.rb in ruby-dnn-0.15.2
- old
+ new
@@ -6,22 +6,21 @@
include DNN::Models
include DNN::Layers
include DNN::Initializers
include DNN::Optimizers
include DNN::Losses
-MNIST = DNN::MNIST
EPOCHS = 3
BATCH_SIZE = 128
-x_train, y_train = MNIST.load_train
-x_test, y_test = MNIST.load_test
+x_train, y_train = DNN::MNIST.load_train
+x_test, y_test = DNN::MNIST.load_test
-x_train = Numo::SFloat.cast(x_train).reshape(x_train.shape[0], 784)
-x_test = Numo::SFloat.cast(x_test).reshape(x_test.shape[0], 784)
+x_train = x_train.reshape(x_train.shape[0], 784)
+x_test = x_test.reshape(x_test.shape[0], 784)
-x_train /= 255
-x_test /= 255
+x_train = Numo::SFloat.cast(x_train) / 255
+x_test = Numo::SFloat.cast(x_test) / 255
y_train = DNN::Utils.to_categorical(y_train, 10, Numo::SFloat)
y_test = DNN::Utils.to_categorical(y_test, 10, Numo::SFloat)
class MLP < Model