Skip to content

Commit

Permalink
add condition if act None (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
backpropper authored and cbfinn committed Nov 10, 2017
1 parent a53ed35 commit fccdf90
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions utils.py
Expand Up @@ -42,7 +42,10 @@ def normalize(inp, activation, reuse, scope):
elif FLAGS.norm == 'layer_norm':
return tf_layers.layer_norm(inp, activation_fn=activation, reuse=reuse, scope=scope)
elif FLAGS.norm == 'None':
return activation(inp)
if activation is not None:
return activation(inp)
else:
return inp

## Loss functions
def mse(pred, label):
Expand All @@ -53,5 +56,3 @@ def mse(pred, label):
def xent(pred, label):
# Note - with tf version <=0.12, this loss has incorrect 2nd derivatives
return tf.nn.softmax_cross_entropy_with_logits(logits=pred, labels=label) / FLAGS.update_batch_size


0 comments on commit fccdf90

Please sign in to comment.