File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,17 @@ def text_callable(layer_index, layer):
145
145
above = bool (layer_index% 2 )
146
146
147
147
# Get the output shape of the layer
148
- output_shape = [x for x in list (layer.output_shape) if x is not None ]
148
+ if hasattr (layer, ' output_shape' ):
149
+ # ───────────────────────────────
150
+ # Legacy Keras (standalone 2.x) or TF-Keras <2.11
151
+ # ───────────────────────────────
152
+ # this will work so long as `layer.output_shape` exists
153
+ output_shape = [x for x in list (layer.output.shape) if x is not None ]
154
+ else :
155
+ # ───────────────────────────────
156
+ # Modern TF-Keras (>= 2.11) – attribute removed
157
+ # ───────────────────────────────
158
+ output_shape = layer.output.shape.as_list()
149
159
150
160
# If the output shape is a list of tuples, we only take the first one
151
161
if isinstance (output_shape[0 ], tuple ):
You can’t perform that action at this time.
0 commit comments