You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
If I understand your code snippet correctly, you want to be able to pass a dict attributes to add_node, correct?
How would you use these in the nodes? Access them via node.attributes?
The following code is simple implementation (Graph class in inferno/extensions/containers/graph.py), I guess.
defadd_node(self, name, module, previous=None, **attr):
""" Add a node to the graph. Parameters ---------- name : str Name of the node. Nodes are identified by their names. attr : dict Attributes of the Nodes. module : torch.nn.Module Torch module for this node. previous : str or list of str (List of) name(s) of the previous node(s). Returns ------- Graph self """assertisinstance(module, nn.Module)
self.add_module(name, module)
self.graph.add_node(name, **attr)
ifpreviousisnotNone:
for_previousinpyu.to_iterable(previous):
self.add_edge(_previous, name)
returnself
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
I would like to set attributes on nodes of
containers.Graph
. If the features is implemented, we can use it more Graph-likely.What I Did(request code)
The text was updated successfully, but these errors were encountered: