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.

layer quant_conv2d_58 expects 2 weights, but the saved weights have 1 elements

See original GitHub issue

Describe the bug

I use Keras to save, then load weights. I got this error

ValueError: Layer #144 (named "quant_conv2d_58" in the current model) was found to correspond to layer quant_conv2d_58 in the save file. However the new layer quant_conv2d_58 expects 2 weights, but the saved weights have 1 elements.

To Reproduce

Expected behavior

Am I missing any config when load weights?

Environment

Ubuntu 18.04 Python 3.6.9 TensorFlow version: tensorflow-gpu 1.15.0 Larq version: larq 0.8.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
leonoverweelcommented, Jan 16, 2020

Great! I’ll close this issue for now; if you run into any other problems, feel free to reopen.

1reaction
leonoverweelcommented, Jan 15, 2020

Sounds good, let me know if this works 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError: Layer #4 (named "predictions") expects 2 weight(s ...
ValueError: Layer #4 (named "predictions") expects 2 weight(s), but the saved weights have 0 element(s). prediction code
Read more >
Save and load models | TensorFlow Core
An index file that indicates which weights are stored in which shard. If you are training a model on a single machine, you'll...
Read more >
Error training Faster RCNN model - NVIDIA Developer Forums
') ValueError: Layer #4 (named "block_1a_conv_1") expects 1 weight(s), but the saved weights have 2 element(s). I am also getting the same error ......
Read more >
Keras load pre-trained weights. Shape mismatch
I have some trouble loading pre-trained weights with Keras. Let's say I have a keras model model and that my weights are stored...
Read more >
Keras- compatibility between Model architecture and saved ...
I saved weights of a fine tuned model with last layer having only two outputs. I could not save the structure of fine...
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