diff --git a/src/graphnet/models/graphs/edges/edges.py b/src/graphnet/models/graphs/edges/edges.py index cb9bf9112..ad3cf3c46 100644 --- a/src/graphnet/models/graphs/edges/edges.py +++ b/src/graphnet/models/graphs/edges/edges.py @@ -26,7 +26,7 @@ def forward(self, graph: Data) -> Data: graph: a graph with edges """ if graph.edge_index is not None: - self.warnonce( + self.warning_once( "GraphBuilder received graph with pre-existing " "structure. Will overwrite." ) diff --git a/src/graphnet/models/graphs/graph_definition.py b/src/graphnet/models/graphs/graph_definition.py index 089eee008..9c4db4d47 100644 --- a/src/graphnet/models/graphs/graph_definition.py +++ b/src/graphnet/models/graphs/graph_definition.py @@ -148,7 +148,8 @@ def forward( # type: ignore if self._edge_definition is not None: graph = self._edge_definition(graph) else: - self.warnonce( + + self.warning_once( """No EdgeDefinition provided. Graphs will not have edges defined!""" # noqa ) @@ -305,10 +306,11 @@ def _add_features_individually( if feature not in ["x"]: # reserved for node features. graph[feature] = graph.x[:, index].detach() else: - self.warnonce( - """Cannot assign graph['x']. This field is reserved - for node features. Please rename your input feature.""" # noqa - ) + self.warning_once( + """Cannot assign graph['x']. This field is reserved for + node features. Please rename your input feature.""" + ) # noqa + return graph def _add_custom_labels(