hasktorch-indef-0.0.1.0: Core Hasktorch abstractions wrapping FFI bindings

Copyright(c) Sam Stites 2017
LicenseBSD3
Maintainersam@stites.io
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Torch.Indef.Static.Tensor.Math.Blas

Description

 
Synopsis

Documentation

addmv Source #

Arguments

:: All KnownDim '[r, c] 
=> HsReal

v1

-> Tensor '[r]

vec1

-> HsReal

v2

-> Tensor '[r, c]

mat

-> Tensor '[c]

vec2

-> Tensor '[r]

res

Performs a matrix-vector multiplication between mat (2D Tensor) and vec2 (1D Tensor) and add it to vec1.

Values v1 and v2 are scalars that multiply vec1 and vec2 respectively. They are optional in C and we may be able to add this to the API in the future.

In other words,

  res = (v1 * vec1) + (v2 * (mat * vec2))

Sizes must respect the matrix-multiplication operation: if mat is a n × m matrix, vec2 must be vector of size m and vec1 must be a vector of size n.

addmv_ Source #

Arguments

:: All KnownDim '[r, c] 
=> HsReal

v1

-> Tensor '[r]

vec1

-> HsReal

v2

-> Tensor '[r, c]

mat

-> Tensor '[c]

vec2

-> IO () 

Inline version of addmv, mutating vec1 inplace.

mv :: All KnownDim '[r, c] => Tensor '[r, c] -> Tensor '[c] -> Tensor '[r] Source #

added simplified use of addmv: src1 #> src2

(!*) :: All KnownDim '[r, c] => Tensor '[r, c] -> Tensor '[c] -> Tensor '[r] Source #

inline version of mv

addmm Source #

Arguments

:: All KnownDim '[a, b, c] 
=> HsReal

v1

-> Tensor '[a, c]

M

-> HsReal

v2

-> Tensor '[a, b]

mat1

-> Tensor '[b, c]

mat2

-> Tensor '[a, c]

res

Performs a matrix-matrix multiplication between mat1 (2D Tensor) and mat2 (2D Tensor).

Values v1 and v2 are scalars that multiply M and mat1 * mat2 respectively. They are optional in C and we may be able to add this to the API in the future.

In other words,

  res = (v1 * M) + (v2 * mat1 * mat2)

If mat1 is a n × m matrix, mat2 a m × p matrix, M must be a n × p matrix.

addmm_ Source #

Arguments

:: All KnownDim '[a, b, c] 
=> HsReal

v1

-> Tensor '[a, c]

M

-> HsReal

v2

-> Tensor '[a, b]

mat1

-> Tensor '[b, c]

mat2

-> IO () 

Inline version of addmm, mutating M inplace.

mmult :: All KnownDim '[a, b, c] => Tensor '[a, b] -> Tensor '[b, c] -> Tensor '[a, c] Source #

simplified wrapper of addmm

FIXME: see if we can pass a null pointer in as the constant value (which might eliminate a noop linear pass).

(!*!) :: All KnownDim '[a, b, c] => Tensor '[a, b] -> Tensor '[b, c] -> Tensor '[a, c] Source #

infix mmult

addr Source #

Arguments

:: All KnownDim '[r, c] 
=> HsReal

v1

-> Tensor '[r, c]

mat_ij

-> HsReal

v2

-> Tensor '[r]

vec1_i

-> Tensor '[c]

vec2_j

-> Tensor '[r, c]

res_ij

Performs the outer-product between vec1 (1D Tensor) and vec2 (1D Tensor).

Values v1 and v2 are scalars that multiply mat_ij and vec1_i [out] vec2_j respectively. They are optional in C and we may be able to add this to the API in the future.

Thus:

  res_ij = (v1 * mat_ij) + (v2 * vec1_i * vec2_j)

If vec1_ is a vector of size i and vec2_j is a vector of size j, then mat_ij must be a matrix of size i × j.

addr_ Source #

Arguments

:: All KnownDim '[r, c] 
=> HsReal

v1

-> Tensor '[r, c]

mat_ij -- mutated inplace

-> HsReal

v2

-> Tensor '[r]

vec1_i

-> Tensor '[c]

vec2_j

-> IO () 

Inline version of addr, mutating mat_ij in-place.

outer :: forall t r c. All KnownDim '[r, c] => Tensor '[r] -> Tensor '[c] -> Tensor '[r, c] Source #

addr with the parameters for an outer product filled in.

addbmm Source #

Arguments

:: All KnownDim '[n, p, b, m] 
=> HsReal

v1

-> Tensor '[n, p]

M

-> HsReal

v2

-> Tensor '[b, n, m]

batch1_i

-> Tensor '[b, m, p]

batch2_i

-> Tensor '[n, p]

res

Batch matrix-matrix product of matrices stored in batch1 and batch2, with a reduced add step (all matrix multiplications get accumulated in a single place).

batch1 and batch2 must be 3D Tensors each containing the same number of matrices. If batch1 is a b × n × m Tensor, batch2 a b × m × p Tensor, res will be a n × p Tensor.

In other words,

  res = (v1 * M) + (v2 * sum(batch1_i * batch2_i, i = 1, b))

addbmm_ Source #

Arguments

:: All KnownDim '[n, p, b, m] 
=> HsReal

v1

-> Tensor '[n, p]

M -- mutated inplace

-> HsReal

v2

-> Tensor '[b, n, m]

batch1_i

-> Tensor '[b, m, p]

batch2_i

-> IO () 

Inline version of addbmm, mutating M in-place.

baddbmm Source #

Arguments

:: All KnownDim '[n, p, b, m] 
=> HsReal

v1

-> Tensor '[b, n, p]

M_i

-> HsReal

v2

-> Tensor '[b, n, m]

batch1_i

-> Tensor '[b, m, p]

batch2_i

-> Tensor '[b, n, p]

res_i

Batch matrix matrix product of matrices stored in batch1 and batch2, with batch add.

batch1 and batch2 must be 3D Tensors each containing the same number of matrices. If batch1 is a b × n × m Tensor, batch2 a b × m × p Tensor, res will be a b × n × p Tensor.

In other words,

  res_i = (v1 * M_i) + (v2 * batch1_i * batch2_i)

baddbmm_ Source #

Arguments

:: All KnownDim '[n, p, b, m] 
=> HsReal

v1

-> Tensor '[b, n, p]

M_i -- mutated inplace

-> HsReal

v2

-> Tensor '[b, n, m]

batch1_i

-> Tensor '[b, m, p]

batch2_i

-> IO () 

Inline version of baddbmm, mutating M_i in-place.

dot :: All Dimensions '[d, d'] => Tensor d -> Tensor d' -> HsAccReal Source #

Performs the dot product between two tensors. The number of elements must match: both tensors are seen as a 1D vector.

(<.>) :: All Dimensions '[d, d'] => Tensor d -> Tensor d' -> HsAccReal Source #

inline alias of dot