Commit 9995c69e authored by Yuxin Wu's avatar Yuxin Wu

use int32 to init global_step explicitly

parent 965aa953
......@@ -46,7 +46,7 @@ def get_global_step_var():
assert scope.name == '', \
"Creating global_step_var under a variable scope would cause problems!"
var = tf.get_variable(GLOBAL_STEP_OP_NAME, shape=[],
initializer=tf.constant_initializer(),
initializer=tf.constant_initializer(value=0, dtype=tf.int32),
trainable=False, dtype=tf.int32)
return var
......
......@@ -72,9 +72,9 @@ def class_balanced_sigmoid_binary_class_cross_entropy(pred, label, name='cross_e
#eps = 1e-12
logstable = tf.log(1 + tf.exp(-tf.abs(z)))
loss_pos = -beta * tf.reduce_mean(-y *
(logstable - tf.minimum(0, z)))
(logstable - tf.minimum(0.0, z)))
loss_neg = (1. - beta) * tf.reduce_mean((y - 1.) *
(logstable + tf.maximum(z, 0)))
(logstable + tf.maximum(z, 0.0)))
cost = tf.sub(loss_pos, loss_neg, name=name)
return cost
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment