Skip to content

hint

hint

A static type for values read inside a trace.

Inside a with model.trace(...) block, reading envoy.output (or .input, a source op, ...) yields a value that behaves like the underlying activation — you can index it, call tensor methods on it, and .save() it to keep it past the block. At runtime that value simply is the activation (a real torch.Tensor, tuple, ...) with .save() mounted on every object.

Object exists only to give that value a name for type hints: it looks like a torch.Tensor (so editors offer tensor methods and indexing) and carries a .save() returning itself. It is never really instantiated — annotate trace-time values with it (def output(self) -> Object) so callers get useful completions.

Object

Bases: Tensor

Tensor-like stand-in for a value read during a trace (hint use only).

save

save(_: Any = 0) -> Self

Keep this value accessible after the trace block exits.

__getattr__

__getattr__(name: str) -> Self

__getitem__

__getitem__(key: Any) -> Self

__call__

__call__(*args: Any, **kwargs: Any) -> Self