data DType { } #
F32

32-bit float

F64

64-bit float

I32

32-bit signed integer

I64

64-bit signed integer

U32

32-bit unsigned integer

U64

64-bit unsigned integer

Bool

Boolean

type Shape = [Int] { } #
Shape is a list of dimension sizes.
type Stride = [Int] { } #
Strides in bytes for each dimension.
type F32 = Float { } #
type F64 = Double { } #
type I32 = Int { } #
type I64 = Integer { } #
dtype :: DType { } #
zeros :: Shape -> Tensor F32 { } #
Create a tensor filled with zeros.
ones :: Shape -> Tensor F32 { } #
Create a tensor filled with ones.
fromList :: Shape -> [a] -> Tensor a { } #
Create a tensor from a list.
fromUArray :: Shape -> (UArray a) -> Tensor a { } #
Create a tensor from an unboxed array.
generate :: Shape -> (Int -> a) -> Tensor a { } #
Generate a tensor using a function.
shape :: (Tensor a) -> Shape { } #
Get the shape of a tensor.
rank :: (Tensor a) -> Int { } #
Get the rank (number of dimensions).
size :: (Tensor a) -> Int { } #
Get the total number of elements.
dtype :: (Tensor a) -> DType { } #
Get the element type.
strides :: (Tensor a) -> Stride { } #
Get the strides.
isContiguous :: (Tensor a) -> Bool { } #
Check if the tensor is contiguous in memory.
reshape :: Shape -> (Tensor a) -> Tensor a { } #
Reshape a tensor (view, no copy if possible).
slice :: [(Int, Int)] -> (Tensor a) -> Tensor a { } #
Slice a tensor (view, no copy).
transpose :: [Int] -> (Tensor a) -> Tensor a { } #
Transpose a tensor (view, no copy).
view :: Shape -> Stride -> (Tensor a) -> Tensor a { } #
Create a view with explicit shape and strides.
map :: (a -> b) -> (Tensor a) -> Tensor b { } #
Map a function over tensor elements.
zipWith :: (a -> b -> c) -> (Tensor a) -> (Tensor b) -> Tensor c { } #
Zip two tensors with a function.
zipWith3 :: (a -> b -> c -> d) -> (Tensor a) -> (Tensor b) -> (Tensor c) -> Tensor d { } #
Zip three tensors with a function.
sum :: (Num a) => (Tensor a) -> a { } #
Sum all elements.
product :: (Num a) => (Tensor a) -> a { } #
Product of all elements.
mean :: (Fractional a) => (Tensor a) -> a { } #
Mean of all elements.
max :: (Ord a) => (Tensor a) -> a { } #
Maximum element.
min :: (Ord a) => (Tensor a) -> a { } #
Minimum element.
argmax :: (Ord a) => (Tensor a) -> Int { } #
Index of maximum element.
argmin :: (Ord a) => (Tensor a) -> Int { } #
Index of minimum element.
fold :: (b -> a -> b) -> b -> (Tensor a) -> b { } #
Fold over tensor elements.
foldl' :: (b -> a -> b) -> b -> (Tensor a) -> b { } #
Strict left fold.
dot :: (Num a) => (Tensor a) -> (Tensor a) -> a { } #
Dot product of two 1D tensors.
matmul :: (Num a) => (Tensor a) -> (Tensor a) -> Tensor a { } #
Matrix multiplication.
outer :: (Num a) => (Tensor a) -> (Tensor a) -> Tensor a { } #
Outer product of two 1D tensors.
trace :: (Num a) => (Tensor a) -> a { } #
Trace of a matrix.
diag :: (Tensor a) -> Tensor a { } #
Diagonal of a matrix.
parMap :: (a -> b) -> (Tensor a) -> Tensor b { } #
Parallel map.
parReduce :: (Monoid m) => (a -> m) -> (Tensor a) -> m { } #
Parallel reduction.
parFor :: (Int, Int) -> (Int -> ()) -> () { } #
Parallel for loop.
materialize :: (Tensor a) -> Tensor a { } #
Force materialization (no fusion).
forceEval :: (Tensor a) -> Tensor a { } #
Force evaluation of tensor elements.