TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-08

ExportedProgram

class tensorplay.export.ExportedProgram(graph_module: GraphModule, graph_signature: ExportGraphSignature | GraphSignature, example_inputs: dict[str, ~typing.Any]=<factory>, dynamic_shapes: Any = None, module_call_graph: list[ModuleCallEntry] = <factory>, range_constraints: dict[~typing.Any, ~typing.Any]=<factory>, equality_constraints: list[EqualityConstraint] = <factory>, verifier: Any = None)[source]

A validated graph together with its state and example bindings.

buffers() → Iterator[Any][source]

Iterate over the captured module’s buffers.

static call_exported(program: ExportedProgram) → Callable[[...], Any][source]

Return a callable executing the flat contract on user arguments.

property code: str

Python source of the captured graph’s generated forward.

classmethod deserialize(artifact: Any, state_dict: Any = None, constants: Any = None, example_inputs: Any = None) → ExportedProgram[source]

Rebuild a program from serialize() artifacts.

invalidate_unlifted() → None[source]

Drop the cached unlifted module so the next call rebuilds it.

module() → GraphModule[source]

Return a self-contained module with lifted state folded back in.

The returned module takes only the user arguments: state placeholders are rewritten into attribute reads on a fresh module that owns the parameter, buffer, and constant values. The result is cached; pass rebind to drop state changes made through this program view.

parameters() → Iterator[Any][source]

Iterate over the captured module’s parameters.

run_decompositions(decomp_table: Any = None) → ExportedProgram[source]

Return a copied program after applying registered graph rewrites.

Entries map a graph target (a callable, a method name, or a target string) to a builder invoked as builder(graph, node); the builder creates the replacement nodes and returns the value users should consume. Nodes whose target has no entry are left untouched.

serialize(opset_version: Any = None, pickle_protocol: int = 4) → Any[source]

Return serialized program artifacts (JSON program + example inputs).

property state_dict: dict[str, Any]

Tensor values of the lifted parameters and persistent buffers.

property tensor_constants: dict[str, Any]

Lifted non-parameter, non-buffer tensor values.

On this page

Ask DeepWiki