An immutable packed Tensor[T] with shared storage and checked shape/stride views.
Signature
Tensor[T]A tensor stores one numeric dtype and a runtime shape. Comma-separated indices select scalar elements; slices preserve tensors and share their allocation. Arithmetic broadcasts trailing dimensions; @ multiplies matrices and batches. Arithmetic and indexing return Res; get returns Opt for a scalar lookup. Dtypes must match, with contextual typing reserved for literal operands.
Methods
len
len() -> f64Returns the receiver's element, byte, or Unicode scalar count.
get
Returns Some(value) for a valid index and None otherwise.
shape
Returns one nonnegative extent for each tensor axis.
reshape
Returns a reshaped tensor or DataError when dimensions do not fit.
transpose
Returns a reordered tensor or DataError for an invalid axis permutation.
sum
Returns the tensor sum or DataError when the operation cannot be represented.
matmul
Returns a matrix product or DataError when tensor shapes are incompatible.
convert
Converts to explicit numeric dtype U or returns DataError when exact conversion fails.
Examples
Slice a matrix
A slice is an immutable view; indexing with one integer per axis returns a typed scalar.
Show a QR code for your glasses, or send a link to another browser. You can keep working here.
Sharing starts a fresh run of the last compiled code. Your editor draft stays here.
Join a session
Open an invitation link, or paste a link or code from the other device.
On RayNeo, open Menu → Connect live and scan this code. In another browser, open the invitation link below.
Or enter this code:
Waiting for another device. You can keep working while it connects.
Browsers can edit code; every device can use scene controls. The device that started the session controls playback.
Connection settings
A full invitation link includes its host. With a code alone, both devices need the same live host. Pairing setup
No output.
- Executed source spans appear here.
Expected output
[2, 2] Some(5)
Rust definition
Value::Tensor(konjure_sdk::data::Tensor); a numeric dtype, shape, strides and shared packed storage.