Keras: DeepCopying a Model with TensorFlow backend gives error

Created on 14 Jan 2016  路  2Comments  路  Source: keras-team/keras

Deep copying a model (TensorFlow backend) gives an error. Theano's backend seems to be working fine.

One possible solution would be to add a method __deepcopy__ to the Model class to teach the deepcopy function to operate on the model, in case the TensorFlow backend is being used.

One workaround would be to just pickle and unpickle the model. I guess that should work, but it looks ugly.

There are many reasons for wanting to deepcopy models. One of them related with the sklearn keras API, which as it is in PR #1225 will only work with Theano.

For more info on the error, one can check the output of a test introduced in the mentioned PR: https://travis-ci.org/fchollet/keras/jobs/100841387

stale

Most helpful comment

If anyone stumbles upon this in the future, a new feature has been added to do just this.

bzamecnik:
In Keras 2.0.7 there's a new function keras.models.clone_model(model, input_tensors) for that purpose.

From: https://github.com/fchollet/keras/issues/1765

All 2 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

If anyone stumbles upon this in the future, a new feature has been added to do just this.

bzamecnik:
In Keras 2.0.7 there's a new function keras.models.clone_model(model, input_tensors) for that purpose.

From: https://github.com/fchollet/keras/issues/1765

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kylemcdonald picture kylemcdonald  路  3Comments

LuCeHe picture LuCeHe  路  3Comments

Imorton-zd picture Imorton-zd  路  3Comments

amityaffliction picture amityaffliction  路  3Comments

nryant picture nryant  路  3Comments