TensorPlay
API reference
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-08

tensorplay.compiler API

Functions 26

#

allow_in_graph

functionFull reference ↗
tensorplay.compiler.allow_in_graph(fn: Any) → Any[source]

Capture a callable as one graph operation without entering its body.

#

compile

functionFull reference ↗
tensorplay.compiler.compile(model: Callable[[...], Any] | None = None, *, fullgraph: bool = False, dynamic: bool | None = None, backend: str | Callable[[...], Any] | None = None, mode: str | None = None, options: dict[str, Any] | None = None, name: str | None = None, disable: bool = False, recompile_limit: int | None = None, isolate_recompiles: bool = False, strict_native: bool = False, dynamic_shapes: Any = None) → Callable[[...], Any][source]

Compile a callable through the TensorPlay capture and lowering pipeline.

#

disallow_in_graph

functionFull reference ↗
tensorplay.compiler.disallow_in_graph(fn: Callable[[...], Any]) → Callable[[...], Any][source]

Declare that a callable must not be absorbed into a captured graph.

The tracer is meant to treat calls to fn as region boundaries: the surrounding pieces are captured as separate graphs and fn itself runs eagerly between them. Under eager execution the marker is inert metadata, so the callable is returned unchanged.

#

list_backends

functionFull reference ↗
tensorplay.compiler.list_backends(exclude_tags: tuple[str, ...] | list[str] | None = ('debug', 'experimental'), *, include_unavailable: bool = False) → list[str][source]

Return registered backend names accepted by compile().

Backends whose optional dependencies are missing are hidden unless include_unavailable is set; selecting one by name produces an error naming what to install.

#

list_mode_options

functionFull reference ↗
tensorplay.compiler.list_mode_options(mode: str | None = None) → dict[str, Any][source]

Return the optimization options each compile mode selects.

With mode set, returns that mode’s option patch; with mode unset, returns the full mode-to-options mapping. Unknown modes raise.

#

mark_static

functionFull reference ↗
tensorplay.compiler.mark_static(tensor: Any, dim: int | None = None) → Any[source]

Mark a tensor (or one dimension of it) as fixed for shape policies.

A marked dimension is meant to be treated as a compile-time constant rather than a symbolic size. Eager execution has no dynamic shape environment, so the marker records nothing here and the input is returned unchanged; it matters only to a capture that resolves symbolic sizes.

#

register_backend

functionFull reference ↗
tensorplay.compiler.register_backend(*args: Any, **kwargs: Any) → Any[source]

Register a backend in the TensorPlay compiler registry.

#

register_experimental_backend

functionFull reference ↗
tensorplay.compiler.register_experimental_backend(*args: Any, **kwargs: Any) → Any[source]

Register a backend tagged for experimental use.

Classes 1

Exceptions 2

#

GraphCaptureError

exceptionFull reference ↗
exception tensorplay.compiler.GraphCaptureError[source]

Raised when Python code cannot be represented by the current graph.

#

InvalidBackend

exceptionFull reference ↗
exception tensorplay.compiler.InvalidBackend(name: str, suggestions: Sequence[str] | None = None)[source]

A backend name that no registered, built-in or entry-point backend owns.

Derives from ValueError (what unknown names raised historically) and RuntimeError (the compiler error family), so either handler works.

On this page

Ask DeepWiki