thunder.core.symbol.BoundSymbol¶
- class thunder.core.symbol.BoundSymbol(sym, args, kwargs, output, subsymbols=(), header='', source_filename=None, source_positions=None, tags=<factory>, _call_ctx=None, _import_ctx=<factory>, _object_ctx=<factory>, _executor=None, _line_no=None)[source]¶
Bases:
BoundSymbolInterface
- Parameters:
sym (Symbol) –
args (tuple) –
kwargs (dict) –
output (Any) –
subsymbols (Sequence[BoundSymbol]) –
source_filename (str | None) –
source_positions (thunder.core.codeutils.Positions | None) –
tags (set[thunder.core.symbol.BoundSymbolTag]) –
_import_ctx (dict) –
_object_ctx (dict) –
_line_no (None | int) –
- __init__(sym, args, kwargs, output, subsymbols=(), header='', source_filename=None, source_positions=None, tags=<factory>, _call_ctx=None, _import_ctx=<factory>, _object_ctx=<factory>, _executor=None, _line_no=None)[source]¶
Methods
__init__
(sym, args, kwargs, output[, ...])from_bsym
(**kwargs)- rtype:
from_bsym_swap_proxies
(swap_map[, ...])Create a new
BoundSymbol
with its inputs, output, and subsymbols updated withswap_map
.gather_ctxs
()has_input
(coll)- rtype:
import_ctx
()name_with_module
()object_ctx
()python
(indent[, commented, print_depth])Attributes
Returns True if all arguments are constant (i.e.
flat_args
flat_args_and_spec
flat_outs
flat_outs_and_spec
flat_proxy_args
flat_proxy_outs
flat_variableified_proxy_args
flat_variableified_proxy_outs
header
rhs
source_filename
source_positions
subsymbols
sym
args
kwargs
output
tags
- from_bsym_swap_proxies(swap_map, skip_inputs=False, skip_output=False, skip_subsymbols=False)[source]¶
Create a new
BoundSymbol
with its inputs, output, and subsymbols updated withswap_map
.This replaces :class:
Proxy``s, e.g. :class:`TensorProxy`, of inputs and output with another ones already seen recorded in ``swap_map
(swap_map
maps variableified :class:Proxy
to an existing one generated by the same expression), and do the same to subsymbols.Turning on some of positional arguments following
swap_map
can be useful, for example, when querying right-hand side expression of aBoundSymbol
inthunder.executors.passes.CSE()
.