Skip to content

Commit b2b6ef4

Browse files
committed
modifications to cifar script
1 parent 975a3a8 commit b2b6ef4

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

scripts/cifar.sc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
import ammonite.ops._
33

4+
import io.github.mandar2812.dynaml.tensorflow._
45
import org.platanios.tensorflow.api._
56
import org.platanios.tensorflow.api.ops.NN.SamePadding
67
import org.platanios.tensorflow.data.image.CIFARLoader
@@ -21,20 +22,20 @@
2122

2223

2324
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+
2529
val trainInput = tf.learn.Input(UINT8, Shape(-1))
30+
2631
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+
3839
val trainingInputLayer = tf.learn.Cast("TrainInput/Cast", INT64)
3940

4041
val loss = tf.learn.SparseSoftmaxCrossEntropy("Loss/CrossEntropy") >>

0 commit comments

Comments
 (0)