AlexanderLutsenko/nobuco

Tensorflow warns that variables were used in Lambda layers but are not present in tracked objects

tcwalther opened this issue ยท 2 comments

First of all, I want to thank you for this absolutely wonderful converter ๐Ÿ™. The process to get started, the documentation and the entire approach are just wonderful. Converting the unsupported layers with the clear error messages works really, really well, and the precision evaluation is simply fantastic.

There's one thing I stumble over that I can't quite figure out. When calling keras_model.predict(x) the first time, TensorFlow initializes the model and complains:

WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.linalg.matmul), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(513, 128) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.linalg.matmul), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(513, 128) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.reshape_3), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(2, 1, 128) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.reshape_3), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(2, 1, 128) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.reshape_2), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(2, 1, 128) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.reshape_2), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(2, 1, 128) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.identity_1), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(1, 27, 1) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.identity_1), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(1, 27, 1) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.math.multiply_51), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(1,) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.math.multiply_51), but are not present in its tracked objects:   <tf.Variable 'weight:0' shape=(1,) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.

Since I'm only running my TF model for inference, this shouldn't make a difference from my understanding. But I'd still love to get rid of these warnings if possible. Do you have any advice on how to fix these?

Hi! I think I fixed the warning in v0.11.1, so these should go away.

Indeed, this fixes it. Thank you so much!