type SameProduct s1 s2 = (Product s1 (~Product) s2) { } #
data DynTensor a { } #
DynTensor { dynData :: !(VU.Vector a), dynShape :: ![Int] }
class KnownShape { } #
xs :: [Nat] { } #
ys :: [Nat] { } #
xs :: [Nat] { } #
b :: [Nat] { } #
shapeVal' :: (Proxy shape) -> [Int] { } #
sizeVal :: (Proxy shape) -> Int { } #
Total number of elements
tensorData :: !(VU.Vector a) { } #
show :: { } #
== :: { } #
zeros :: forall shape a. (KnownShape shape, Num a, VU.Unbox a) { } #
O(n). Create tensor filled with zeros.
ones :: forall shape a. (KnownShape shape, Num a, VU.Unbox a) { } #
full :: forall shape a. (KnownShape shape, VU.Unbox a) { } #
fromList :: forall shape a. (KnownShape shape, VU.Unbox a) { } #
otherwise :: { } #
eye :: forall n a. (KnownNat n, Num a, VU.Unbox a) { } #
O(n²). Create an n×n identity matrix.
shapeVal :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shapeVal { } #
reshape :: forall s1 s2 a. (SameProduct s1 s2, VU.Unbox a) { } #
s2 :: { } #
transpose :: forall m n a. (KnownNat m, KnownNat n, VU.Unbox a) { } #
O(n). Transpose a 2D tensor (swap rows and columns).
srcIdx :: { } #
dstIdx :: { } #
flatten :: forall shape a. (KnownShape shape, VU.Unbox a) { } #
a :: [Nat] { } #
unsqueeze :: forall dim shape a. VU.Unbox a { } #
O(1). Add a dimension of size 1 at the specified position.
a :: [Nat] { } #
squeeze :: forall shape result a. (SameProduct shape result, VU.Unbox a) { } #
O(1). Remove all dimensions of size 1.
result :: { } #
n :: Nat { } #
xs :: [Nat] { } #
x :: Nat { } #
broadcast :: forall shape target a. (KnownShape shape, KnownShape target, BroadcastValid shape target, Broadcast shape target (~target), VU.Unbox a) { } #
paddedSrc :: { } #
srcStrides :: { } #
tgtStrides :: { } #
tgtIndices :: { } #
srcIndices :: { } #
srcIdx :: { } #
tMap :: (VU.Unbox a, VU.Unbox b) { } #
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tZipWith :: (VU.Unbox a, VU.Unbox b, VU.Unbox c) { } #
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tAdd :: (Num a, VU.Unbox a) { } #
O(n). Element-wise addition.
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tSub :: (Num a, VU.Unbox a) { } #
O(n). Element-wise subtraction.
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tMul :: (Num a, VU.Unbox a) { } #
O(n). Element-wise multiplication (Hadamard product).
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tDiv :: (Fractional a, VU.Unbox a) { } #
O(n). Element-wise division.
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tNeg :: (Num a, VU.Unbox a) { } #
O(n). Negate all elements.
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tAbs :: (Num a, VU.Unbox a) { } #
O(n). Absolute value of all elements.
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tSqrt :: (Floating a, VU.Unbox a) { } #
O(n). Square root of all elements.
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tExp :: (Floating a, VU.Unbox a) { } #
O(n). Exponential (e^x) of all elements.
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tLog :: (Floating a, VU.Unbox a) { } #
O(n). Natural logarithm of all elements.
shape :: forall shape a. (KnownShape shape) => (Tensor shape a) -> [Int] shape { } #
tSum :: (Num a, VU.Unbox a) { } #
a :: [Nat] { } #
tMean :: forall shape a. (KnownShape shape, Fractional a, VU.Unbox a) { } #
O(n). Arithmetic mean of all tensor elements.
dot :: (Num a, VU.Unbox a) { } #
a :: [Nat] { } #
matmul :: forall m k n a. (KnownNat m, KnownNat k, KnownNat n, Num a, VU.Unbox a) { } #
O(m·k·n). Matrix multiplication.
matvec :: forall m n a. (KnownNat m, KnownNat n, Num a, VU.Unbox a) { } #
toDynamic :: (KnownShape shape) => (Tensor shape a) -> DynTensor a toDynamic t { } #
O(1). Convert a shaped tensor to a dynamic tensor.
fromDynamic :: forall shape a. (KnownShape shape, VU.Unbox a) { } #
otherwise :: { } #
withShape :: forall shape a r. (KnownShape shape, VU.Unbox a) { } #
Apply a function to a dynamic tensor if it matches the expected shape.
r :: { } #
toList :: VU.Unbox a { } #
O(n). Convert tensor to a flat list (row-major order).
computeStrides :: { } #
go :: { } #
instance KnownShape '[] { }