PropagateUnbackedSymInts¶
- class torch.fx.experimental.symbolic_shapes.PropagateUnbackedSymInts(module, garbage_collect_values=True, graph=None)[source]¶
- boxed_run(args_list)¶
Run module via interpretation and return the result. This uses the “boxed” calling convention, where you pass a list of arguments, which will be cleared by the interpreter. This ensures that input tensors are promptly deallocated.
Note
Backwards-compatibility for this API is guaranteed.
- call_function(target, args, kwargs)¶
Execute a
call_function
node and return the result.- Parameters
target (Target) – The call target for this node. See Node for details on semantics
args (Tuple) – Tuple of positional args for this invocation
kwargs (Dict) – Dict of keyword arguments for this invocation
- Return type
- Return
Any: The value returned by the function invocation
Note
Backwards-compatibility for this API is guaranteed.
- call_method(target, args, kwargs)¶
Execute a
call_method
node and return the result.- Parameters
target (Target) – The call target for this node. See Node for details on semantics
args (Tuple) – Tuple of positional args for this invocation
kwargs (Dict) – Dict of keyword arguments for this invocation
- Return type
- Return
Any: The value returned by the method invocation
Note
Backwards-compatibility for this API is guaranteed.
- call_module(target, args, kwargs)¶
Execute a
call_module
node and return the result.- Parameters
target (Target) – The call target for this node. See Node for details on semantics
args (Tuple) – Tuple of positional args for this invocation
kwargs (Dict) – Dict of keyword arguments for this invocation
- Return type
- Return
Any: The value returned by the module invocation
Note
Backwards-compatibility for this API is guaranteed.
- fetch_args_kwargs_from_env(n)¶
Fetch the concrete values of
args
andkwargs
of noden
from the current execution environment.- Parameters
n (Node) – The node for which
args
andkwargs
should be fetched.- Returns
args
andkwargs
with concrete values forn
.- Return type
Tuple[Tuple, Dict]
Note
Backwards-compatibility for this API is guaranteed.
- fetch_attr(target)¶
Fetch an attribute from the
Module
hierarchy ofself.module
.- Parameters
target (str) – The fully-qualified name of the attribute to fetch
- Returns
The value of the attribute.
- Return type
Any
Note
Backwards-compatibility for this API is guaranteed.
- get_attr(target, args, kwargs)¶
Execute a
get_attr
node. Will retrieve an attribute value from theModule
hierarchy ofself.module
.- Parameters
target (Target) – The call target for this node. See Node for details on semantics
args (Tuple) – Tuple of positional args for this invocation
kwargs (Dict) – Dict of keyword arguments for this invocation
- Returns
The value of the attribute that was retrieved
- Return type
Any
Note
Backwards-compatibility for this API is guaranteed.
- map_nodes_to_values(args, n)¶
Recursively descend through
args
and look up the concrete value for eachNode
in the current execution environment.- Parameters
args (Argument) – Data structure within which to look up concrete values
n (Node) – Node to which
args
belongs. This is only used for error reporting.
- Return type
Optional[Union[Tuple[Any, …], List[Any], Dict[str, Any], slice, range, Node, str, int, float, bool, complex, dtype, Tensor, device, memory_format, layout, OpOverload, SymInt, SymBool, SymFloat]]
Note
Backwards-compatibility for this API is guaranteed.
- output(target, args, kwargs)¶
Execute an
output
node. This really just retrieves the value referenced by theoutput
node and returns it.- Parameters
target (Target) – The call target for this node. See Node for details on semantics
args (Tuple) – Tuple of positional args for this invocation
kwargs (Dict) – Dict of keyword arguments for this invocation
- Returns
The return value referenced by the output node
- Return type
Any
Note
Backwards-compatibility for this API is guaranteed.
- placeholder(target, args, kwargs)¶
Execute a
placeholder
node. Note that this is stateful:Interpreter
maintains an internal iterator over arguments passed torun
and this method returns next() on that iterator.- Parameters
target (Target) – The call target for this node. See Node for details on semantics
args (Tuple) – Tuple of positional args for this invocation
kwargs (Dict) – Dict of keyword arguments for this invocation
- Returns
The argument value that was retrieved.
- Return type
Any
Note
Backwards-compatibility for this API is guaranteed.
- run(*args, initial_env=None, enable_io_processing=True)¶
Run module via interpretation and return the result.
- Parameters
*args – The arguments to the Module to run, in positional order
initial_env (Optional[Dict[Node, Any]]) – An optional starting environment for execution. This is a dict mapping Node to any value. This can be used, for example, to pre-populate results for certain Nodes so as to do only partial evaluation within the interpreter.
enable_io_processing (bool) – If true, we process the inputs and outputs with graph’s process_inputs and process_outputs function first before using them.
- Returns
The value returned from executing the Module
- Return type
Any
Note
Backwards-compatibility for this API is guaranteed.