“Layer is not connected” issue while accessing intermediate layer from custom callback if model is built by sub-classing #41009
Labels
comp:keras
Keras related issues
stat:awaiting tensorflower
Status - Awaiting response from tensorflower
TF 2.11
Issues related to TF 2.11
type:bug
Bug
System information
Yes
Linux Ubuntu 18.04.2 LTS
N/A
Binary
v2.2.0-rc4-8-g2b96f3662b 2.2.0
Python 3.7.3
N/A
N/A
CUDA 10.2
NVIDIA TITAN X (Pascal), ~12GB
Describe the current behavior
I've a simple model and need access of intermediate layers within a custom callback to get intermediate predictions. If I build the model by sub-classing, I get the error
AttributeError: Layer dense is not connected
.Describe the expected behavior
It shouldn't cause any error and be able to get predictions using intermediate layers.
Standalone code to reproduce the issue
Other info / logs
Traceback:
If I build the model using functional API as shown below, it works fine:
Here's the stackoverflow question I created on the same issue.
The text was updated successfully, but these errors were encountered: