Skip to content

Commit 829c9aa

Browse files
authored
_get_node_attribute_at_index() raising AttributeError instead of ValueError (#20156)
#20155 This commit allows using hasattr() on on node attributes, without raising an error.
1 parent f4a4725 commit 829c9aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

keras/src/ops/operation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def _get_node_attribute_at_index(self, node_index, attr, attr_name):
282282
The operation's attribute `attr` at the node of index `node_index`.
283283
"""
284284
if not self._inbound_nodes:
285-
raise ValueError(
285+
raise AttributeError(
286286
f"The layer {self.name} has never been called "
287287
f"and thus has no defined {attr_name}."
288288
)

0 commit comments

Comments
 (0)