From 19c7683d6a34f56de0bfc7329783eaa72f17e101 Mon Sep 17 00:00:00 2001 From: Charles Lu Date: Sun, 26 Nov 2017 20:10:02 +0000 Subject: [PATCH] fix bug when lang_stats not set to 1 --- train.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/train.py b/train.py index 08e30f09..674e228d 100644 --- a/train.py +++ b/train.py @@ -171,8 +171,9 @@ def train(opt): # Write validation result into summary if tf is not None: add_summary_value(tf_summary_writer, 'validation loss', val_loss, iteration) - for k,v in lang_stats.items(): - add_summary_value(tf_summary_writer, k, v, iteration) + if lang_stats is not None: + for k,v in lang_stats.items(): + add_summary_value(tf_summary_writer, k, v, iteration) tf_summary_writer.flush() val_result_history[iteration] = {'loss': val_loss, 'lang_stats': lang_stats, 'predictions': predictions}