|
1 | 1 | { |
2 | 2 | import ammonite.ops._ |
3 | 3 |
|
| 4 | + import io.github.mandar2812.dynaml.tensorflow._ |
4 | 5 | import org.platanios.tensorflow.api._ |
5 | 6 | import org.platanios.tensorflow.api.ops.NN.SamePadding |
6 | 7 | import org.platanios.tensorflow.data.image.CIFARLoader |
|
21 | 22 |
|
22 | 23 |
|
23 | 24 | println("Building the logistic regression model.") |
24 | | - val input = tf.learn.Input(UINT8, Shape(-1, dataSet.trainImages.shape(1), dataSet.trainImages.shape(2), dataSet.trainImages.shape(3))) |
| 25 | + val input = tf.learn.Input( |
| 26 | + UINT8, Shape(-1, dataSet.trainImages.shape(1), dataSet.trainImages.shape(2), dataSet.trainImages.shape(3)) |
| 27 | + ) |
| 28 | + |
25 | 29 | val trainInput = tf.learn.Input(UINT8, Shape(-1)) |
| 30 | + |
26 | 31 | val layer = tf.learn.Cast("Input/Cast", FLOAT32) >> |
27 | | - tf.learn.Conv2D("Layer_0/Conv2D", Shape(2, 2, 3, 16), 1, 1, SamePadding) >> |
28 | | - tf.learn.AddBias("Layer_0/Bias") >> |
29 | | - tf.learn.ReLU("Layer_0/ReLU", 0.1f) >> |
30 | | - tf.learn.MaxPool("Layer_0/MaxPool", Seq(1, 2, 2, 1), 1, 1, SamePadding) >> |
31 | | - tf.learn.Conv2D("Layer_1/Conv2D", Shape(2, 2, 16, 32), 1, 1, SamePadding) >> |
32 | | - tf.learn.AddBias("Bias_1") >> |
33 | | - tf.learn.ReLU("Layer_1/ReLU", 0.1f) >> |
34 | | - tf.learn.MaxPool("Layer_1/MaxPool", Seq(1, 2, 2, 1), 1, 1, SamePadding) >> |
35 | | - tf.learn.Flatten("Layer_2/Flatten") >> |
36 | | - tf.learn.Linear("Layer_2/Linear", 256) >> tf.learn.ReLU("Layer_2/ReLU", 0.1f) >> |
37 | | - tf.learn.Linear("OutputLayer/Linear", 10) |
| 32 | + dtflearn.conv2d_pyramid(2, 3)(4, 2)(0.1f, true, 0.6F) >> |
| 33 | + tf.learn.MaxPool("Layer_3/MaxPool", Seq(1, 2, 2, 1), 1, 1, SamePadding) >> |
| 34 | + tf.learn.Flatten("Layer_3/Flatten") >> |
| 35 | + dtflearn.feedforward(256)(id = 4) >> |
| 36 | + tf.learn.ReLU("Layer_4/ReLU", 0.1f) >> |
| 37 | + dtflearn.feedforward(10)(id = 5) |
| 38 | + |
38 | 39 | val trainingInputLayer = tf.learn.Cast("TrainInput/Cast", INT64) |
39 | 40 |
|
40 | 41 | val loss = tf.learn.SparseSoftmaxCrossEntropy("Loss/CrossEntropy") >> |
|
0 commit comments