Open cw1091293482 opened 6 years ago
@cw1091293482 I resolved this issue in TensorFlow 1.3:
Change the line
to this: for f, lineno, method, * in result._traceback:
A TensorFlow 1.x traceback entry is like:
('D:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\spyder\\utils\\ipython\\start_kernel.py', 241, '<module>', {'__name__': '__main__', '__doc__': '\nFile used to start kernels for the IPython Console\n', '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x0000021474E75CF8>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': 'D:\\Anaconda3\\envs\\tensorflow\\lib\\site-packages\\spyder\\utils\\ipython\\start_kernel.py', '__cached__': None, 'os': <module 'os' from 'D:\\Anaconda3\\envs\\tensorflow\\lib\\os.py'>, 'osp': <module 'ntpath' from 'D:\\Anaconda3\\envs\\tensorflow\\lib\\ntpath.py'>, 'sys': <module 'sys' (built-in)>, 'IS_EXT_INTERPRETER': True, 'sympy_config': <function sympy_config at 0x00000214799891E0>, 'kernel_config': <function kernel_config at 0x0000021479989268>, 'varexp': <function varexp at 0x00000214799892F0>, 'main': <function main at 0x0000021479989378>}, 9, None)
which contains 6 elements, thus the ValueError
when only expect 4 inputs.
Using *_ to take arbitrary number of inputs will get this problem fixed!
@hanzhanggit
@Lotayou Can't understand what you mean.
I am using version R 1.2 of tensorflow to run the training process, that is python stageI/run_exp.py --cfg stageI/cfg/flowers.yml --gpu 0 but bug has happened like this: x_code = self.d_encode_img_template.construct(input= pt.wrap(x_var)) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1248, in construct return self._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1173, in _construct method_args = self._replace_deferred(self._method_args, context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1145, in _replace_deferred return [self._replace_deferred(x, context) for x in arg] File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1140, in _replace_deferred return arg._construct(context) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1176, in _construct _strip_unnecessary_contents_from_stack(result, set()) File "/usr/local/lib/python2.7/dist-packages/prettytensor/pretty_tensor_class.py", line 1335, in _strip_unnecessary_contents_from_stack for f, lineno, method, in result._traceback: ValueError: too many values to unpack
it is because the line: x_code = self.d_encode_img_template.construct(input= pt.wrap(x_var)) in script model.py, How to use 'construct' in tensorflow R 1.2.
the original code are based on tensorflow R0.12 , so how to transfer the construct between R0.12 and R 1.2? or did someone meet this kind issue?
Any response will be appreciated, thanks in advanced!