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

ValueError: Operands could not be broadcast together with shapes , when converting with change_ordering #128

Open
shairoz-deci opened this issue Mar 22, 2021 · 1 comment
Labels

Comments

@shairoz-deci
Copy link

shairoz-deci commented Mar 22, 2021

Describe the bug
When loading a model and trying to convert it from pytorch to keras with change_ordering=True, I get an error.
is there a way to resolve or figure out which layers require tuning?
Running with change_ordering=False works properly

  File "/home/shai/.conda/envs/shai-development/lib/python3.7/site-packages/tensorflow/python/keras/layers/merge.py", line 85, in _compute_elemwise_op_output_shape
    'together with shapes ' + str(shape1) + ' ' + str(shape2))
ValueError: Operands could not be broadcast together with shapes (56, 56, 64) (64, 1, 64)

To Reproduce

from timm.models.regnet import regnety_008
import pytorch2keras
dims = (1, 3, 224, 224)
keras_model = pytorch2keras.pytorch_to_keras(regnety_008(), torch.randn(dims, requires_grad=False), [dims[1:]], verbose=True, change_ordering=True)

Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Python 3.7
  • TF 2.4.0
  • torch 1.7.1
  • pytorch2keras 0.2.4
@robertarnesson
Copy link

Any luck? Having the same problem

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

No branches or pull requests

2 participants