Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidArgumentError (see above for traceback): Input to reshape is a tensor with 401408 values, but the requested shape has 802816 #22

Open
ZechCal opened this issue Oct 22, 2020 · 1 comment

Comments

@ZechCal
Copy link

ZechCal commented Oct 22, 2020

10-20 12:02:08 - x - INFO: - Input to reshape is a tensor with 401408 values, but the requested shape has 802816
[[node BatchGather/Reshape_2 (defined at /home/zxy/3dtest/3D-Face-GCNs/utils.py:832) ]]
[[node render_1/strided_slice_34 (defined at /home/zxy/anaconda3/envs/tensorglue/lib/python3.6/site-packages/rasterize_triangles.py:121) ]]

Caused by op 'BatchGather/Reshape_2', defined at:
File "main.py", line 142, in
main()
File "main.py", line 95, in main
model = NormalModel(args, sess, graph, refer_mesh, image_paths, img_file)
File "/home/zxy/3dtest/3D-Face-GCNs/model_normal.py", line 16, in init
super(Model, self).init(*args, **kwargs)
File "/home/zxy/3dtest/3D-Face-GCNs/base_model.py", line 115, in init
self.build_graph()
File "/home/zxy/3dtest/3D-Face-GCNs/base_model.py", line 200, in build_graph
pred_results = self.inference(self.train_rgbas, self.coeff, self.image_emb)
File "/home/zxy/3dtest/3D-Face-GCNs/base_model.py", line 354, in inference
proj_color = self.project_color(proj_vert, eros_image)
File "/home/zxy/3dtest/3D-Face-GCNs/base_model.py", line 1029, in project_color
proj_color = utils.batch_gather(flatten_image, coords)
File "/home/zxy/3dtest/3D-Face-GCNs/utils.py", line 718, in batch_gather
return _batch_gather(params, indices, batch_dims=indices.shape.ndims - 1)
File "/home/zxy/3dtest/3D-Face-GCNs/utils.py", line 832, in _batch_gather
flat_params = tf.reshape(params, tf.concat([[flat_inner_shape], outer_shape], axis=0))
File "/home/zxy/anaconda3/envs/tensorglue/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 7179, in reshape
"Reshape", tensor=tensor, shape=shape, name=name)
File "/home/zxy/anaconda3/envs/tensorglue/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/zxy/anaconda3/envs/tensorglue/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/zxy/anaconda3/envs/tensorglue/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/zxy/anaconda3/envs/tensorglue/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Input to reshape is a tensor with 401408 values, but the requested shape has 802816
[[node BatchGather/Reshape_2 (defined at /home/zxy/3dtest/3D-Face-GCNs/utils.py:832) ]]
[[node render_1/strided_slice_34 (defined at /home/zxy/anaconda3/envs/tensorglue/lib/python3.6/site-packages/rasterize_triangles.py:121) ]]

Several tests proved that the input tensor and requested tensor always have a 401408 difference (no matter how big or small the batch is). Need help......

@ZechCal
Copy link
Author

ZechCal commented Oct 26, 2020

It seems that if change the batch to 2, the problem will be solved...... But why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant