Heterogeneous graph interpretation #
An interpreter supplies a scalar family indexed by DType, its storage, available
arithmetic, and explicit conversions. Values still contain ordinary TorchLean
tensors. Shape erasure reuses Spec.SomeTensor; only the element-type index is
added at the interchange boundary.
Ordinary numeric nodes reuse Graph.evalNodeRaw. Typed casts and registered
custom operations are dispatched separately, with the result's scalar type fixed
by the program's type assignment. Unsupported types and operations return errors.
No cast is implemented by relabeling a tensor or converting through host Float.
Layout operations reuse Graph.evalTransform and need only storage, not arithmetic.
Pointwise operators reuse Graph.evalPointwise, which also needs only storage: a type with an
arithmetic dictionary takes their meanings from Spec.PointwiseOp.meaning, and a type without
one, such as an integer type, from the interpreter's own pointwise table.
Scalar representations and operations supplied to the shared typed graph interpreter.
Actual Lean carrier for each element descriptor.
- storage (dtype : DType) : TorchLean.Storage (self.Scalar dtype)
Physical tensor representation for that carrier.
Whether this interpreter implements the described element representation.
Optional full arithmetic dictionary, used by the existing numerical operator evaluator.
- cast (source target : DType) : FloatLib.Floats.Formats.BinaryInterchange.Model.IEEERoundingMode → self.Scalar source → Except String (self.Scalar target × FloatLib.Floats.ExecFloat.ConversionStatus)
Convert one element, retaining flags; failures are explicit.
- pointwise (dtype : DType) : Spec.PointwiseTable (self.Scalar dtype)
Pointwise operators for element types without an arithmetic dictionary, such as integers. Types with a dictionary use
Spec.PointwiseOp.meaninginstead; the default lists none.
Instances For
A tensor with both its element descriptor and its shape preserved.
- dtype : DType
- tensor : Spec.SomeTensor (interpreter.Scalar self.dtype)
Instances For
Runtime shape retained by the shared tensor package.
Instances For
Recover a tensor only after checking its element-type index.
Instances For
Typed constants, existing homogeneous parameter stores, and extension implementations.
Constants retain their actual scalar carrier, including Boolean and integer tensors.
- homogeneous (dtype : DType) : IR.Payload (interpreter.Scalar dtype)
Existing numerical payloads, selected at the operation's scalar type.
- call (name : Lean.Name) (output : DType) : Array interpreter.Value → Except String (Spec.SomeTensor (interpreter.Scalar output) × FloatLib.Floats.ExecFloat.ConversionStatus)
Implement a registered operation at its declared output type; names are not guessed.
Instances For
Convert a tensor element by element, accumulating FloatLib's conversion flags.
Instances For
Evaluate one node using already computed values and a complete argument table.
Instances For
Evaluate a typed program, returning every intermediate tensor and accumulated cast flags.
Instances For
Evaluate the designated results in return order, retaining conversion flags.