From e4d949f4ed284bc901a3fa43a07a44fb7f0a94b2 Mon Sep 17 00:00:00 2001 From: spacemunkay Date: Tue, 12 Jun 2018 14:00:34 -0700 Subject: [PATCH] Add informative msg when img size mismatch --- ops.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ops.py b/ops.py index e4a2847bc..e65ef1711 100644 --- a/ops.py +++ b/ops.py @@ -94,8 +94,13 @@ def linear(input_, output_size, scope=None, stddev=0.02, bias_start=0.0, with_w= shape = input_.get_shape().as_list() with tf.variable_scope(scope or "Linear"): - matrix = tf.get_variable("Matrix", [shape[1], output_size], tf.float32, + try: + matrix = tf.get_variable("Matrix", [shape[1], output_size], tf.float32, tf.random_normal_initializer(stddev=stddev)) + except ValueError as err: + msg = "NOTE: Usually, this is due to an issue with the image dimensions. Did you correctly set '--crop' or '--input_height' or '--output_height'?" + err.args = err.args + (msg,) + raise bias = tf.get_variable("bias", [output_size], initializer=tf.constant_initializer(bias_start)) if with_w: