Skip to content

Commit 008f27b

Browse files
committed
reducing number of hidden neurons to 32
1 parent 09a5e51 commit 008f27b

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

examples/DigitRecognition/deep_mlp.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Auto generated by utensor-cli
22

3-
#include "uTensor/ops/MatrixOps.hpp"
4-
#include "uTensor/core/context.hpp"
53
#include "deep_mlp_weight.hpp"
6-
#include "uTensor/ops/MathOps.hpp"
74
#include "uTensor/ops/ArrayOps.hpp"
5+
#include "uTensor/ops/MatrixOps.hpp"
6+
#include "deep_mlp.hpp"
87
#include "uTensor/ops/NnOps.hpp"
8+
#include "uTensor/ops/MathOps.hpp"
99
#include "uTensor/core/tensor.hpp"
10-
#include "deep_mlp.hpp"
10+
#include "uTensor/core/context.hpp"
1111

1212

1313
void get_deep_mlp_ctx(Context& ctx, Tensor* input_0) {
@@ -60,7 +60,7 @@ void get_deep_mlp_ctx(Context& ctx, Tensor* input_0) {
6060
ctx.eval();
6161
}
6262
{
63-
ctx.add(new BinaryTensor<uint8_t>({784,64}, inline_Variable_quantized_const_0),
63+
ctx.add(new BinaryTensor<uint8_t>({784,32}, inline_Variable_quantized_const_0),
6464
"Variable_quantized_const:0",
6565
1);
6666
}
@@ -101,7 +101,7 @@ void get_deep_mlp_ctx(Context& ctx, Tensor* input_0) {
101101
ctx.eval();
102102
}
103103
{
104-
ctx.add(new BinaryTensor<float>({64}, inline_Variable_1_0),
104+
ctx.add(new BinaryTensor<float>({32}, inline_Variable_1_0),
105105
"Variable_1:0",
106106
2);
107107
}
@@ -185,7 +185,7 @@ void get_deep_mlp_ctx(Context& ctx, Tensor* input_0) {
185185
ctx.eval();
186186
}
187187
{
188-
ctx.add(new BinaryTensor<float>({64,10}, inline_Variable_2_0),
188+
ctx.add(new BinaryTensor<float>({32,10}, inline_Variable_2_0),
189189
"Variable_2:0",
190190
2);
191191
}

examples/DigitRecognition/deep_mlp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ def bias_variable(shape, name):
3030

3131
# Fully connected 2 layer NN
3232
def deepnn(x):
33-
W_fc1 = weight_variable([784, 64], name='W_fc1')
34-
b_fc1 = bias_variable([64], name='b_fc1')
33+
W_fc1 = weight_variable([784, 32], name='W_fc1')
34+
b_fc1 = bias_variable([32], name='b_fc1')
3535
a_fc1 = tf.add(tf.matmul(x, W_fc1), b_fc1, name="zscore")
3636
h_fc1 = tf.nn.relu(a_fc1)
3737
layer1 = tf.nn.dropout(h_fc1, 0.50)
3838

39-
W_fc2 = weight_variable([64, 10], name='W_fc3')
39+
W_fc2 = weight_variable([32, 10], name='W_fc3')
4040
b_fc2 = bias_variable([10], name='b_fc3')
4141
logits = tf.add(tf.matmul(layer1, W_fc2), b_fc2, name="logits")
4242
y_pred = tf.argmax(logits, 1, name='y_pred')
@@ -118,10 +118,10 @@ def main(_):
118118
help='session check point (default: %(default)s)')
119119
parser.add_argument('-n', '--num-iteration', type=int,
120120
dest='num_iter',
121-
default=20000,
121+
default=100000,
122122
help='number of iterations (default: %(default)s)')
123123
parser.add_argument('--batch-size', dest='batch_size',
124-
default=50, type=int,
124+
default=150, type=int,
125125
help='batch size (default: %(default)s)')
126126
parser.add_argument('--log-every-iters', type=int,
127127
dest='log_iter', default=1000,

examples/DigitRecognition/deep_mlp_weight.hpp

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)