Skip to content

Commit

Permalink
MNIST MLP
Browse files Browse the repository at this point in the history
  • Loading branch information
fegin committed Jun 7, 2015
1 parent 6401655 commit 1d6d60c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spartan/examples/mnist_mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def __init__(self, data_file='mnist_all.mat', num_epochs=100, mb_size=256,
#self.w2 = np.random.randn(l3, l2) * math.sqrt(4.0 / (l2 + l3))
#self.b1 = np.zeros([l2, 1])
#self.b2 = np.zeros([l3, 1])
self.w1 = (spartan.randn(l2, l1) * math.sqrt(4.0 / (l1 + l2))).optimized().evaluate()
self.w2 = (spartan.randn(l3, l2) * math.sqrt(4.0 / (l2 + l3))).optimized().evaluate()
self.b1 = (spartan.zeros([l2, 1])).optimized().evaluate()
self.b2 = (spartan.zeros([l3, 1])).optimized().evaluate()
self.w1 = (spartan.randn(l2, l1) * math.sqrt(4.0 / (l1 + l2))).evaluate()
self.w2 = (spartan.randn(l3, l2) * math.sqrt(4.0 / (l2 + l3))).evaluate()
self.b1 = (spartan.zeros([l2, 1])).evaluate()
self.b2 = (spartan.zeros([l3, 1])).evaluate()

def run(self):
(train_data, test_data) = load_mb_from_mat(self.data_file, self.mb_size)
Expand Down Expand Up @@ -140,7 +140,7 @@ def run(self):
self.b2 -= self.eps_b * gb2

iterations -= 1
out.optimized().evaluate()
out.evaluate()
self.w1.evaluate()
self.w2.evaluate()
self.b1.evaluate()
Expand Down

0 comments on commit 1d6d60c

Please sign in to comment.