Home / Docs / Standard library / Prelude

tensor

Release v0.4.0Edition 0.5 preview

A function of the prelude, in scope in every module. Edition 0.5 preview.

una
pub tensor[T](shape: List[Int], elements: List[T]) -> Tensor[T]

A tensor of the lengths in shape, a list literal of 1 to 8 of them, with the elements of elements in row-major order (spec/29 §17). Each call takes the contract of its rank: requires every length >= 0 and elements.len their product; ensures result.rank the literal's length and result.dim(axis: k) the k-th length. A shape that is not a list literal is U2038. O(n).

Specification

Generated from the standard modules of una v0.4.0 (docs/std/listing.json, which is not part of the specification). The specification governs: spec/14 §1.