Skip to content

Instantly share code, notes, and snippets.

@JLeavell
Created May 11, 2018 20:52
INFO:tensorflow:Calling model_fn.
ValueErrorTraceback (most recent call last)
<ipython-input-6-1882d5ed9c2a> in <module>()
9 input_fn=train_input_fn,
10 steps=20000,
---> 11 hooks=[logging_hook])
/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.pyc in train(self, input_fn, hooks, steps, max_steps, saving_listeners)
361
362 saving_listeners = _check_listeners_type(saving_listeners)
--> 363 loss = self._train_model(input_fn, hooks, saving_listeners)
364 logging.info('Loss for final step: %s.', loss)
365 return self
/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.pyc in _train_model(self, input_fn, hooks, saving_listeners)
841 return self._train_model_distributed(input_fn, hooks, saving_listeners)
842 else:
--> 843 return self._train_model_default(input_fn, hooks, saving_listeners)
844
845 def _train_model_default(self, input_fn, hooks, saving_listeners):
/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.pyc in _train_model_default(self, input_fn, hooks, saving_listeners)
854 worker_hooks.extend(input_hooks)
855 estimator_spec = self._call_model_fn(
--> 856 features, labels, model_fn_lib.ModeKeys.TRAIN, self.config)
857 return self._train_with_estimator_spec(estimator_spec, worker_hooks,
858 hooks, global_step_tensor,
/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.pyc in _call_model_fn(self, features, labels, mode, config)
829
830 logging.info('Calling model_fn.')
--> 831 model_fn_results = self._model_fn(features=features, **kwargs)
832 logging.info('Done calling model_fn.')
833
<ipython-input-4-78df2dfbf323> in cnn_model_fn(features, labels, mode)
24 """Model function for CNN."""
25 # Input Layer
---> 26 input_layer = tf.reshape(features["x"], [-1, 100, 100, 1])
27
28 # Convolutional Layer #1
/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.pyc in reshape(tensor, shape, name)
6111 if _ctx is None or not _ctx._eager_context.is_eager:
6112 _, _, _op = _op_def_lib._apply_op_helper(
-> 6113 "Reshape", tensor=tensor, shape=shape, name=name)
6114 _result = _op.outputs[:]
6115 _inputs_flat = _op.inputs
/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.pyc in _apply_op_helper(self, op_type_name, name, **keywords)
785 op = g.create_op(op_type_name, inputs, output_types, name=scope,
786 input_types=input_types, attrs=attr_protos,
--> 787 op_def=op_def)
788 return output_structure, op_def.is_stateful, op
789
/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.pyc in create_op(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_shapes, compute_device)
3390 input_types=input_types,
3391 original_op=self._default_original_op,
-> 3392 op_def=op_def)
3393
3394 # Note: shapes are lazily computed with the C API enabled.
/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.pyc in __init__(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def)
1732 op_def, inputs, node_def.attr)
1733 self._c_op = _create_c_op(self._graph, node_def, grouped_inputs,
-> 1734 control_input_ops)
1735 else:
1736 self._c_op = None
/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.pyc in _create_c_op(graph, node_def, inputs, control_inputs)
1568 except errors.InvalidArgumentError as e:
1569 # Convert to ValueError for backwards compatibility.
-> 1570 raise ValueError(str(e))
1571
1572 return c_op
ValueError: Dimension size must be evenly divisible by 10000 but is 100 for 'Reshape' (op: 'Reshape') with input shapes: [100], [4] and with input tensors computed as partial shapes: input[1] = [?,100,100,1].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment