paarthneekhara / text-to-image

Text to image synthesis using thought vectors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

From merging shape 0 with other shapes. for 'h3_concat/concat_dim' (op: 'Pack') with input shapes: [8,4,4,512], [8,4,4,256].

conquistador3 opened this issue · comments

Traceback (most recent call last):
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\ops.py", line 1628, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 3 in both shapes must be equal, but are 512 and 256. Shapes are [8,4,4,512] and [8,4,4,256].
From merging shape 0 with other shapes. for 'h3_concat/concat_dim' (op: 'Pack') with input shapes: [8,4,4,512], [8,4,4,256].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "generate_images.py", line 106, in
main()
File "generate_images.py", line 64, in main
_, _, _, _, _ = gan.build_model()
File "C:\Users\RanjanNi\Desktop\t2i_skip\Python 3 Codes\model.py", line 39, in build_model
disc_real_image, disc_real_image_logits = self.discriminator(t_real_image, t_real_caption)
File "C:\Users\RanjanNi\Desktop\t2i_skip\Python 3 Codes\model.py", line 171, in discriminator
h3_concat = tf.concat( 3, [h3, tiled_embeddings], name='h3_concat')
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1121, in concat
dtype=dtypes.int32).get_shape().assert_is_compatible_with(
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\ops.py", line 1050, in convert_to_tensor
as_ref=False)
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\ops.py", line 1146, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\array_ops.py", line 971, in _autopacking_conversion_function
return _autopacking_helper(v, dtype, name or "packed")
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\array_ops.py", line 923, in _autopacking_helper
return gen_array_ops.pack(elems_as_tensors, name=scope)
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 5856, in pack
"Pack", values=values, axis=axis, name=name)
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\util\deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\ops.py", line 3274, in create_op
op_def=op_def)
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\ops.py", line 1792, in init
control_input_ops)
File "C:\Users\RanjanNi\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\ops.py", line 1631, in _create_c_op
raise ValueError(str(e))
ValueError: Dimension 3 in both shapes must be equal, but are 512 and 256. Shapes are [8,4,4,512] and [8,4,4,256].
From merging shape 0 with other shapes. for 'h3_concat/concat_dim' (op: 'Pack') with input shapes: [8,4,4,512], [8,4,4,256].

change this line h3_concat = tf.concat( 3, [h3, tiled_embeddings], name='h3_concat') to h3_concat = tf.concat([h3, tiled_embeddings], 3, name='h3_concat')

This worked for me!

WARNING:tensorflow:From /home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
Traceback (most recent call last):
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1659, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 1 in both shapes must be equal, but are 100 and 256. Shapes are [64,100] and [64,256].
From merging shape 0 with other shapes. for 'concat/concat_dim' (op: 'Pack') with input shapes: [64,100], [64,256].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 238, in
main()
File "train.py", line 76, in main
input_tensors, variables, loss, outputs, checks = gan.build_model()
File "/home/hp/Gan_project_main/text_image_gan/model.py", line 37, in build_model
fake_image = self.generator(t_z, t_real_caption)
File "/home/hp/Gan_project_main/text_image_gan/model.py", line 137, in generator
z_concat = tf.concat(1, [t_z, reduced_text_embedding])
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py", line 180, in wrapper
return target(*args, **kwargs)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py", line 1253, in concat
dtype=dtypes.int32).get_shape().assert_is_compatible_with(
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1039, in convert_to_tensor
return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1097, in convert_to_tensor_v2
as_ref=False)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1175, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py", line 1102, in _autopacking_conversion_function
return _autopacking_helper(v, dtype, name or "packed")
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py", line 1054, in _autopacking_helper
return gen_array_ops.pack(elems_as_tensors, name=scope)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 5448, in pack
"Pack", values=values, axis=axis, name=name)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1823, in init
control_input_ops)
File "/home/hp/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1662, in _create_c_op
raise ValueError(str(e))
ValueError: Dimension 1 in both shapes must be equal, but are 100 and 256. Shapes are [64,100] and [64,256].
From merging shape 0 with other shapes. for 'concat/concat_dim' (op: 'Pack') with input shapes: [64,100], [64,256].

how can solve it??please reply as soon as possible

Me to.. : )
InvalidArgumentError: Dimension 0 in both shapes must be equal, but are 788 and 444. Shapes are [788,444,3] and [444,788,3]. From merging shape 0 with other shapes. for 'stack_7' (op: 'Pack') with input shapes: [788,444,3], [444,788,3], [444,788,3].
and
ValueError: Dimension 0 in both shapes must be equal, but are 788 and 444. Shapes are [788,444,3] and [444,788,3]. From merging shape 0 with other shapes. for 'stack_7' (op: 'Pack') with input shapes: [788,444,3], [444,788,3], [444,788,3].

@remyavijeesh22 did you resolve your problem?