Skip to content

Commit

Permalink
_get_node_attribute_at_index() raising AttributeError instead of Valu…
Browse files Browse the repository at this point in the history
…eError (#20156)

#20155

This commit allows using hasattr() on on node attributes, without raising an error.
  • Loading branch information
Doch88 authored Aug 23, 2024
1 parent f4a4725 commit 829c9aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion keras/src/ops/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _get_node_attribute_at_index(self, node_index, attr, attr_name):
The operation's attribute `attr` at the node of index `node_index`.
"""
if not self._inbound_nodes:
raise ValueError(
raise AttributeError(
f"The layer {self.name} has never been called "
f"and thus has no defined {attr_name}."
)
Expand Down

0 comments on commit 829c9aa

Please sign in to comment.