why keras model param values change when it is accessed in a tensorflow session?
why keras model param values change when it is accessed in a tensorflow session? I was having trouble with my transfer learning implementation. I guess I found the root cause but it is not clear to me why it works like that. Here is the explanation... If I create a model (e.g. resnet50 from keras.applications), and then try to use it in a tensorflow session, weights all of a sudden change. Here is a simple example: First import the necessary libraries: import tensorflow as tf from keras.applications.resnet50 import ResNet50 from keras.models import Model Then define the model as following: model = ResNet50(weights='imagenet') Now print out parameters from one of the layers as following: model.get_layer('conv1').get_weights() The output is long but it starts as following: [array([[[[ 2.82526277e-02, -1.18737184e-02, 1.51488732e-03, ..., -1.07003953e-02, -5.27982824e-02, -1.36667420e-03], [ 5.86827798e-03, 5.04415408e-02, 3.46324709e-03, ..., ...