The in-progress representation of an AnvlGraph during tracing. This is
a mutable class.
While trace_fn() runs a function, every primitive call is recorded as a
GraphStatement into the current descriptor (see graph_desc_add() and
current_descriptor()). The descriptor also does the book-keeping the
trace needs: which GraphValue an AnvlArray or GraphBox stands
for, the constants and devices encountered, and the default data types the
trace is pinned to. Once tracing finishes, it is converted to an
AnvlGraph, which only keeps what is needed to lower and run the
program.
Arguments
- statements
(
list(GraphStatement))
The statements that make up the graph.- array_to_gval
(
hashtab)
Mapping:AnvlArray->GraphValue- gval_to_box
(
hashtab)
Mapping:GraphValue->GraphBox- constants
(
list(GraphValue))
The constants of the graph.- in_tree
(
NULL|RTree)
The tree of inputs. May contain leaves for both array inputs and static (non-array) arguments. Only the array leaves correspond to entries ininputs; useis_static_flatto distinguish them.- out_tree
(
NULL|RTree)
The tree of outputs.- inputs
(
list(GraphValue))
The inputs to the graph (array arguments only).- outputs
(
list(GraphValue))
The outputs of the graph.- is_static_flat
(
NULL | logical())
Boolean mask indicating which flat positions inin_treeare static (non-array) args.NULLwhen all args are array inputs.- static_args_flat
(
NULL | list())
Flattened traced values for the static arguments indicated byis_static_flat.- devices
(
list())
Devices encountered during tracing: the device of every concrete array registered in the graph, plus the ones declared bygraph_desc_add().- default_dtypes
(
NULL|list(float, int))
The data types every R value in this trace materializes at when nothing else decides one (seedefault_dtypes()).- backend
(
character(1))
The backend this trace is compiled for. Required: it decides which entry of theanvl.default_dtypesoption applies to the trace, so switching the active backend inside a traced body changes nothing.local_descriptor()fills it in fromactive_backend(), so only a direct call has to name it.