Avoid nan when there are no reg_losses
@@ -127,6 +127,7 @@ def run(net_class, param, volume_loader, device_str):
if param.decay > 0:
reg_losses = graph.get_collection(
tf.GraphKeys.REGULARIZATION_LOSSES)
+ if reg_losses:
reg_loss = tf.reduce_mean([tf.reduce_mean(reg_loss)
for reg_loss in reg_losses])
loss = loss + reg_loss
