opto.trace.nodes.MessageNode#
- class MessageNode[source]#
A node representing the output of an operator.
The description string should begin with [operator_name] followed by details about the operator. When referring to inputs in the description, use either: - The keys in args (if args is a dict) - The names of the nodes in args (if args is a list)
Examples
>>> MessageNode(node_a, inputs=[node_a], >>> description="[identity] This is an identity operator.") >>> MessageNode(copy_node_a, inputs=[node_a], >>> description="[copy] This is a copy operator.") >>> MessageNode(1, inputs={'a':node_a, 'b':node_b}, >>> description="[Add] This is an add operator of a and b.")
- value#
The output value of the operator
Initialize an instance of the Node class.
- Parameters:
value β The value to be assigned to the node.
name β The name of the node (optional).
trainable β A boolean indicating whether the node is trainable or not (optional).
description β A string describing the node (optional).
constraint β A string describing constraints on the node (optional).
info β A dictionary containing additional information about the node (optional).
Attributes
Get the children of a node.
Retrieve the internal data of a node.
A textual description of the node.
The depended expandable nodes.
The feedback from children nodes.
Returns the set of hidden dependencies that are not visible in the current graph level.
Get the identifier part of the node's name.
Additional information about the node.
Input nodes to the operator
Check if the node is a leaf node.
Check if the node is a root node.
Get the level of the node in the graph.
Get the name of the node.
The depended parameters.
Get the parents of a node.
Get the Python-friendly name of the node.
The type of the data stored in the node.
Methods
append
(*args, **kwargs)backward
([feedback, propagator, ...])Performs a backward pass in a computational graph.
call
(fun, *args, **kwargs)Call the function with the specified arguments and keyword arguments.
clone
()Create and return a duplicate of the current Node object.
detach
()Create and return a deep copy of the current instance of the Node class.
eq
(other)Check if the node is equal to another value.
format
(*args, **kwargs)getattr
(key)Get the attribute of the node with the specified key.
gt
(other)Compare if this node's level is greater than another node's level.
items
()join
(seq)keys
()len
()Return the length of the node.
lower
()lt
(other)Compare if this node's level is less than another node's level.
neq
(other)Check if the node is not equal to another value.
pop
([_Node__index])replace
(old, new[, count])split
([sep, maxsplit])strip
([chars])swapcase
()title
()upper
()values
()Zero out the feedback of the node.
- __init__(value, *, inputs: List[Node] | Dict[str, Node], description: str, constraint=None, name=None, info=None) None [source]#
Initialize an instance of the Node class.
- Parameters:
value β The value to be assigned to the node.
name β The name of the node (optional).
trainable β A boolean indicating whether the node is trainable or not (optional).
description β A string describing the node (optional).
constraint β A string describing constraints on the node (optional).
info β A dictionary containing additional information about the node (optional).
- __new__(**kwargs)#