question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError: Dimension 1 in both shapes must be equal, but are 3 and 2

See original GitHub issue

Can you please guide how to fix this error?

mona@pascal:~/computer_vision/VPilot$ python drive.py model.h5 8000 320 160 
Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so.5.0 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so.8.0 locally
/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py:368: UserWarning: The `regularizers` property of layers/models is deprecated. Regularization losses are now managed via the `losses` layer/model property.
  warnings.warn('The `regularizers` property of '
Traceback (most recent call last):
  File "drive.py", line 61, in <module>
    model = aitorNet.getModel(weights_path=args.weights)
  File "/home/mona/computer_vision/VPilot/model.py", line 106, in getModel
    model.load_weights(weights_path)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2701, in load_weights
    self.load_weights_from_hdf5_group(f)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2787, in load_weights_from_hdf5_group
    K.batch_set_value(weight_value_tuples)
  File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1544, in batch_set_value
    assign_op = x.assign(assign_placeholder)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/ops/variables.py", line 505, in assign
    return state_ops.assign(self._variable, value, use_locking=use_locking)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/ops/gen_state_ops.py", line 45, in assign
    use_locking=use_locking, name=name)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/framework/op_def_library.py", line 749, in apply_op
    op_def=op_def)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/framework/ops.py", line 2390, in create_op
    set_shapes_for_outputs(ret)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/framework/ops.py", line 1785, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/framework/common_shapes.py", line 596, in call_cpp_shape_fn
    raise ValueError(err.message)
ValueError: Dimension 1 in both shapes must be equal, but are 3 and 2

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
parkerzfcommented, Jan 23, 2017

From the error log, I guess the weight file in weights_path is not compatible to the model in:

model = aitorNet.getModel(weights_path=args.weights)

0reactions
zhaoyucongcommented, Dec 17, 2018

@senthilv83 我也遇到了同样的错误 你的这个错误您解决了吗

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dimension 1 in both shapes must be equal, but are 324 and 8 ...
ValueError : Dimension 1 in both shapes must be equal, but are 8 and 16. Shapes are [1024,8] and [1024,16].
Read more >
Dimension 2 in both shapes must be equal, but are 3 and 1
Let us start by inspecting your error alongside the code you have provided. x = tf.concat([data, fake], axis=0) ValueError: Dimension 2 in ...
Read more >
Can't predict dataset with varying resolution - TensorFlow Forum
InvalidArgumentError: ConcatOp : Dimension 1 in both shapes must be equal: shape[0] = [1,10,10,3] vs. shape[1] = [1,12,9,3] [Op:ConcatV2] ...
Read more >
Dimension 1 in both shapes must be equal, but are 8 and 324.
成功解决raise ValueError(str(e)) ValueError: Dimension 1 in both shapes must be equal, but are 1034 and 1024. Shapes ...
Read more >
Struggling with shapes on a custom layer : r/tensorflow - Reddit
ValueError : The outer 2 dimensions of indices.shape=[?,1,4] must match the ... Dimension 1 in both shapes must be equal, but are 1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found