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

Optimizer - set_weights : check weights length #9435

Merged
merged 1 commit into from
Feb 20, 2018

Conversation

cbensimon
Copy link
Contributor

This PR fixes a little inconsistency that I encountered using Keras, described below :

model = Model(...)
model.compile(...)
optimizer_weights = model.optimizer.get_weights()
# value is [], as optimizer.get_updates has not been called yet
model._make_train_function()
# Now optimizer has proper weights
model.optimzier.set_weights(optimizer_weights)
# Runs without error, but has no effect
len(model.optimizer.get_weights()) == len(optimizer_weights)
# Obviously not, which is counterintuitive

It is my first PR, I apologize in advance if the format is not correct.
Thank you

Copy link
Collaborator

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fchollet fchollet merged commit 531a8ea into keras-team:master Feb 20, 2018
lenjoy pushed a commit to lenjoy/keras that referenced this pull request Feb 22, 2018
dschwertfeger added a commit to dschwertfeger/keras that referenced this pull request Feb 26, 2018
…ack-embeddings-from-layer-outputs

* upstream/master: (443 commits)
  Fix `pool_2d` of Theano for backend compatibility (keras-team#9479)
  Clean up conv backend tests (keras-team#9478)
  Refactoring of ConvLSTM2D. Added ConvRNN2D and ConvLSTM2DCell. (keras-team#9094)
  Fix different results over three backends for ResNet50 and MobileNet (keras-team#9473)
  Add depthwise conv2d for Theano and CNTK (keras-team#9457)
  Fix ImageDataGenerator preprocessing_function (keras-team#9273)
  Add separable conv2d for CNTK (keras-team#9442)
  Remove word “shuffled” from comments in examples (keras-team#9453)
  Add random brightness to Image Preprocessing (Code Cleanup) (keras-team#9390)
  Only print Theano RNN dropout warning when needed.
  Add train test split to DirectoryIterator (keras-team#6152)
  Misc: Slight optimisation (keras-team#9445)
  Force update of Sequences for Windows (keras-team#9436)
  Move tests for datasets (keras-team#9439)
  Style fixes (keras-team#9441)
  Increase test coverages by excluding several lines (keras-team#9428)
  Fixing minor bug in pretrained_word_embeddings example (keras-team#9438)
  Optimizer - set_weights : check weights length (keras-team#9435)
  Add `conv_utils_test` (keras-team#9429)
  Enable `variable_input_channels` test for `InceptionV3` (keras-team#9425)
  ...
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

Successfully merging this pull request may close these issues.

2 participants