Skip to content

Commit

Permalink
Modified to comply with Tensorflow 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaikollara committed Feb 16, 2017
1 parent 412284e commit 6ee73fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion configuration.py
@@ -1,5 +1,5 @@
config = {
'n_epochs' : 20,
'n_epochs' : 5,
'kernel_sizes' : [3, 4, 5],
'dropout_rate' : 0.5,
'val_split' : 0.4,
Expand Down
6 changes: 3 additions & 3 deletions model.py
Expand Up @@ -57,11 +57,11 @@ def build_model(self):
maxC3 = tf.nn.max_pool(C3, [1,C3.get_shape()[1],1,1] , [1,1,1,1], padding='VALID')
maxC3 = tf.squeeze(maxC3, [1,2])
#Concatenating pooled features
z = tf.concat(1, [maxC1, maxC2, maxC3])
z = tf.concat(axis=1, values=[maxC1, maxC2, maxC3])
zd = tf.nn.dropout(z, self.cur_drop_rate)
# Fully connected layer
self.y = tf.add(tf.matmul(zd,W), b)
losses = tf.nn.sparse_softmax_cross_entropy_with_logits(self.y, self.labels)
losses = tf.nn.sparse_softmax_cross_entropy_with_logits(logits=self.y, labels=self.labels)

self.loss = tf.reduce_mean(losses)
self.optim = tf.train.AdamOptimizer(learning_rate=0.001)
Expand All @@ -70,7 +70,7 @@ def build_model(self):
def train(self, data, labels):
self.build_model()
n_batches = int(ceil(data.shape[0]/self.batch_size))
tf.initialize_all_variables().run()
tf.global_variables_initializer().run()
t_data, t_labels, v_data, v_labels = data_utils.generate_split(data, labels, self.val_split)
for epoch in range(1,self.n_epochs+1):
train_cost = 0
Expand Down

0 comments on commit 6ee73fe

Please sign in to comment.