From fccdf906cb09c26a609f98002a8e7bc3a8d3a832 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Fri, 10 Nov 2017 16:45:33 -0500 Subject: [PATCH] add condition if act None (#17) --- utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils.py b/utils.py index 3aae9d2c7..e89e4d881 100644 --- a/utils.py +++ b/utils.py @@ -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): @@ -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 - -