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
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.
Most helpful comment
If anyone stumbles upon this in the future, a new feature has been added to do just this.
From: https://github.com/fchollet/keras/issues/1765