class torch.fx.Node(graph, name, op, target, args, kwargs, type=None) [source]
 
Node is the data structure that represents individual operations within a Graph. For the most part, Nodes represent callsites to various entities, such as operators, methods, and Modules (some exceptions include nodes that specify function inputs and outputs). Each Node has a function specified by its op property. The Node semantics for each value of op are as follows:  
placeholder represents a function input. The name attribute specifies the name this value will take on. target is similarly the name of the argument. args holds either: 1) nothing, or 2) a single argument denoting the default parameter of the function input. kwargs is don’t-care. Placeholders correspond to the function parameters (e.g. x) in the graph printout. 
get_attr retrieves a parameter from the module hierarchy. name is similarly the name the result of the fetch is assigned to. target is the fully-qualified name of the parameter’s position in the module hierarchy. args and kwargs are don’t-care 
call_function applies a free function to some values. name is similarly the name of the value to assign to. target is the function to be applied. args and kwargs represent the arguments to the function, following the Python calling convention 
call_module applies a module in the module hierarchy’s forward() method to given arguments. name is as previous. target is the fully-qualified name of the module in the module hierarchy to call. args and kwargs represent the arguments to invoke the module on, including the self argument. 
call_method calls a method on a value. name is as similar. target is the string name of the method to apply to the self argument. args and kwargs represent the arguments to invoke the module on, including the self argument
 
output contains the output of the traced function in its args[0] attribute. This corresponds to the “return” statement in the Graph printout.   
property all_input_nodes  
Return all Nodes that are inputs to this Node. This is equivalent to iterating over args and kwargs and only collecting the values that are Nodes.  Returns 
List of Nodes that appear in the args and kwargs of this Node, in that order.   
  
append(x) [source]
 
Insert x after this node in the list of nodes in the graph. Equvalent to self.next.prepend(x)  Parameters 
x (Node) – The node to put after this node. Must be a member of the same graph.   
  
property args  
The tuple of arguments to this Node. The interpretation of arguments depends on the node’s opcode. See the Node docstring for more information. Assignment to this property is allowed. All accounting of uses and users is updated automatically on assignment. 
  
property kwargs  
The dict of keyword arguments to this Node. The interpretation of arguments depends on the node’s opcode. See the Node docstring for more information. Assignment to this property is allowed. All accounting of uses and users is updated automatically on assignment. 
  
property next  
Returns the next Node in the linked list of Nodes.  Returns 
The next Node in the linked list of Nodes.   
  
prepend(x) [source]
 
Insert x before this node in the list of nodes in the graph. Example: Before: p -> self
        bx -> x -> ax
After:  p -> x -> self
        bx -> ax
  Parameters 
x (Node) – The node to put before this node. Must be a member of the same graph.   
  
property prev  
Returns the previous Node in the linked list of Nodes.  Returns 
The previous Node in the linked list of Nodes.   
  
replace_all_uses_with(replace_with) [source]
 
Replace all uses of self in the Graph with the Node replace_with.  Parameters 
replace_with (Node) – The node to replace all uses of self with.  Returns 
The list of Nodes on which this change was made.