-
Notifications
You must be signed in to change notification settings - Fork 0
Tensor
Raul Montoya Cardenas edited this page Jul 29, 2026
·
2 revisions

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)
src/tensor/mod.rs — row-major dense f32 tensor.
pub struct Tensor {
data: Vec<f32>,
shape: Vec<usize>,
strides: Vec<usize>,
}Serialize / Deserialize via serde.
| Method | Notes |
|---|---|
from_vec(data, shape) |
Asserts data.len() == product(shape)
|
zeros / ones / full
|
Fill constructors |
randn(shape, mean, std) |
Box–Muller via rand
|
data, data_mut, shape, strides, numel, ndim.
| Method | Notes |
|---|---|
reshape |
Same numel |
transpose |
2-D only |
add / sub / mul
|
Element-wise, same shape |
scale / add_scalar
|
Broadcast scalar |
relu, approximate gelu, silu, fast_sigmoid (surrogate-style).
sum, mean, max_val, argmax, softmax_last (1-D or per-row 2-D), row(idx).
Shape/transpose/softmax/gelu unit tests live in-module.
Last updated: July 29, 2026
Updated by: Grok Build: Grok 4.5
Package tip reference: 37c5a21 (main)