Skip to content

Commit e4d949f

Browse files
committed
Add informative msg when img size mismatch
1 parent 3041fa3 commit e4d949f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ops.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,13 @@ def linear(input_, output_size, scope=None, stddev=0.02, bias_start=0.0, with_w=
9494
shape = input_.get_shape().as_list()
9595

9696
with tf.variable_scope(scope or "Linear"):
97-
matrix = tf.get_variable("Matrix", [shape[1], output_size], tf.float32,
97+
try:
98+
matrix = tf.get_variable("Matrix", [shape[1], output_size], tf.float32,
9899
tf.random_normal_initializer(stddev=stddev))
100+
except ValueError as err:
101+
msg = "NOTE: Usually, this is due to an issue with the image dimensions. Did you correctly set '--crop' or '--input_height' or '--output_height'?"
102+
err.args = err.args + (msg,)
103+
raise
99104
bias = tf.get_variable("bias", [output_size],
100105
initializer=tf.constant_initializer(bias_start))
101106
if with_w:

0 commit comments

Comments
 (0)