Skip to content

Instantly share code, notes, and snippets.

@pbexe
Created January 23, 2017 19:32
Show Gist options
  • Save pbexe/6f26c7b59ba3bd421e0995b110fce624 to your computer and use it in GitHub Desktop.
Save pbexe/6f26c7b59ba3bd421e0995b110fce624 to your computer and use it in GitHub Desktop.
Tensorflow error
Traceback (most recent call last):
File "C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1021, in _do_call
return fn(*args)
File "C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1003, in _run_fn
status, run_metadata)
File "C:\Python35\lib\contextlib.py", line 66, in __exit__
next(self.gen)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 469, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [21758,1500] rhs shape= [14531,1500]
[[Node: save/Assign = Assign[T=DT_FLOAT, _class=["loc:@Variable"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](Variable, save/RestoreV2)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 120, in <module>
print(use_neural_network(input('>>> ')))
File "train.py", line 99, in use_neural_network
saver.restore(sess,"./model.ckpt")
File "C:\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1388, in restore
{self.saver_def.filename_tensor_name: save_path})
File "C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line 766, in run
run_metadata_ptr)
File "C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line 964, in _run
feed_dict_string, options, run_metadata)
File "C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1014, in _do_run
target_list, options, run_metadata)
File "C:\Python35\lib\site-packages\tensorflow\python\client\session.py", line 1034, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [21758,1500] rhs shape= [14531,1500]
[[Node: save/Assign = Assign[T=DT_FLOAT, _class=["loc:@Variable"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](Variable, save/RestoreV2)]]
Caused by op 'save/Assign', defined at:
File "train.py", line 120, in <module>
print(use_neural_network(input('>>> ')))
File "train.py", line 98, in use_neural_network
saver = tf.train.Saver()
File "C:\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1000, in __init__
self.build()
File "C:\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1030, in build
restore_sequentially=self._restore_sequentially)
File "C:\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 624, in build
restore_sequentially, reshape)
File "C:\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 373, in _AddRestoreOps
assign_ops.append(saveable.restore(tensors, shapes))
File "C:\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 130, in restore
self.op.get_shape().is_fully_defined())
File "C:\Python35\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 47, in assign
use_locking=use_locking, name=name)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 759, in apply_op
op_def=op_def)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2240, in create_op
original_op=self._default_original_op, op_def=op_def)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1128, in __init__
self._traceback = _extract_stack()
InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [21758,1500] rhs shape= [14531,1500]
[[Node: save/Assign = Assign[T=DT_FLOAT, _class=["loc:@Variable"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](Variable, save/RestoreV2)]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment