You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a layer class is used as attribute, the code will throw a TypeError exception when calling self._gather_children_attribute. It appears that the layer class is tracked.
Describe the expected behavior
Only layer instances should be tracked, not classes.
Traceback (most recent call last):
File "tf2/class.py", line 10, in <module>
print(layer.variables)
File "/tmp/tf2/local/lib/python2.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1330, in variables
return self.weights
File "/tmp/tf2/local/lib/python2.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 708, in weights
return self.trainable_weights + self.non_trainable_weights
File "/tmp/tf2/local/lib/python2.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 687, in trainable_weights
nested = self._gather_children_attribute('trainable_weights')
File "/tmp/tf2/local/lib/python2.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1850, in _gather_children_attribute
getattr(layer, attribute) for layer in nested_layers))
TypeError: 'property' object is not iterable
The text was updated successfully, but these errors were encountered:
@qlzh727 this is a better project for someone working on TF Keras. I am realistically never going to get to it. (It's near code I've modified, but I don't think those modifications made the situation any worse.)
The layer class was incorrectly tracked by layer._layer, which should
only track layer instance. This should be mitigated once b/110718070 is
fixed.
PiperOrigin-RevId: 243103748
System information
2.0.0.dev20190402
Describe the current behavior
When a layer class is used as attribute, the code will throw a
TypeError
exception when callingself._gather_children_attribute
. It appears that the layer class is tracked.Describe the expected behavior
Only layer instances should be tracked, not classes.
Code to reproduce the issue
Other info / logs
The text was updated successfully, but these errors were encountered: