MCPcopy Create free account
hub / github.com/pytorch/pytorch / call_function

Method call_function

torch/fx/graph.py:1171–1203  ·  view source on GitHub ↗

Insert a ``call_function`` ``Node`` into the ``Graph``. A ``call_function`` node represents a call to a Python callable, specified by ``the_function``. Args: the_function (Callable[..., Any]): The function to be called. Can be any PyTorch operat

(self,
                      the_function: Callable[..., Any],
                      args: Optional[Tuple['Argument', ...]] = None,
                      kwargs: Optional[Dict[str, 'Argument']] = None,
                      type_expr: Optional[Any] = None)

Source from the content-addressed store, hash-verified

1169
1170 @compatibility(is_backward_compatible=True)
1171 def call_function(self,
1172 the_function: Callable[..., Any],
1173 args: Optional[Tuple['Argument', ...]] = None,
1174 kwargs: Optional[Dict[str, 'Argument']] = None,
1175 type_expr: Optional[Any] = None) -> Node:
1176 """
1177 Insert a ``call_function`` ``Node`` into the ``Graph``. A ``call_function`` node
1178 represents a call to a Python callable, specified by ``the_function``.
1179
1180 Args:
1181
1182 the_function (Callable[..., Any]): The function to be called. Can be any PyTorch
1183 operator, Python function, or member of the ``builtins`` or ``operator``
1184 namespaces.
1185
1186 args (Optional[Tuple[Argument, ...]]): The positional arguments to be passed
1187 to the called function.
1188
1189 kwargs (Optional[Dict[str, Argument]]): The keyword arguments to be passed
1190 to the called function
1191
1192 type_expr (Optional[Any]): an optional type annotation representing the
1193 Python type the output of this node will have.
1194
1195 Returns:
1196
1197 The newly created and inserted ``call_function`` node.
1198
1199 .. note::
1200 The same insertion point and type expression rules apply for this method
1201 as :meth:`Graph.create_node`.
1202 """
1203 return self.create_node('call_function', the_function, args, kwargs, type_expr=type_expr)
1204
1205 @compatibility(is_backward_compatible=True)
1206 def node_copy(self, node: Node, arg_transform: Callable[[Node], 'Argument'] = lambda x: x) -> Node:

Callers 15

create_fx_from_snodesFunction · 0.95
gen_gm_and_inputsFunction · 0.95
build_moduleMethod · 0.95
test_custom_importMethod · 0.95
test_all_input_nodesMethod · 0.95
test_graph_fnsMethod · 0.95
test_remove_usesMethod · 0.95
test_insertion_pointMethod · 0.95
test_move_beforeMethod · 0.95

Calls 1

create_nodeMethod · 0.95