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.Dynamic.Tensor.Math.Blas

Description

Blas functions.

Synopsis

Documentation

addmv Source #

Arguments

:: HsReal

v1

-> Dynamic

vec1

-> HsReal

v2

-> Dynamic

mat

-> Dynamic

vec2

-> Dynamic

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.

addmm Source #

Arguments

:: HsReal

v1

-> Dynamic

M

-> HsReal

v2

-> Dynamic

mat1

-> Dynamic

mat2

-> Dynamic

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.

addr Source #

Arguments

:: HsReal

v1

-> Dynamic

mat_ij

-> HsReal

v2

-> Dynamic

vec1_i

-> Dynamic

vec2_j

-> Dynamic

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.

addbmm Source #

Arguments

:: HsReal

v1

-> Dynamic

M

-> HsReal

v2

-> Dynamic

batch1_i

-> Dynamic

batch2_i

-> Dynamic

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))

baddbmm Source #

Arguments

:: HsReal

v1

-> Dynamic

M_i

-> HsReal

v2

-> Dynamic

batch1_i

-> Dynamic

batch2_i

-> Dynamic

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)

addmv_ Source #

Arguments

:: HsReal

v1

-> Dynamic

vec1

-> HsReal

v2

-> Dynamic

mat

-> Dynamic

vec2

-> IO () 

Inline version of addmv, mutating vec1 inplace.

addmm_ Source #

Arguments

:: HsReal

v1

-> Dynamic

M

-> HsReal

v2

-> Dynamic

mat1

-> Dynamic

mat2

-> IO () 

Inline version of addmm, mutating M inplace.

addr_ Source #

Arguments

:: HsReal

v1

-> Dynamic

mat_ij -- mutated inplace

-> HsReal

v2

-> Dynamic

vec1_i

-> Dynamic

vec2_j

-> IO () 

Inline version of addr, mutating mat_ij in-place.

addbmm_ Source #

Arguments

:: HsReal

v1

-> Dynamic

M

-> HsReal

v2

-> Dynamic

batch1_i

-> Dynamic

batch2_i

-> IO () 

Inline version of addbmm, mutating M in-place.

baddbmm_ Source #

Arguments

:: HsReal

v1

-> Dynamic

M_i

-> HsReal

v2

-> Dynamic

batch1_i

-> Dynamic

batch2_i

-> IO () 

Inline version of baddbmm, mutating M_i in-place.

dot :: Dynamic -> Dynamic -> HsAccReal Source #

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

(<.>) :: Dynamic -> Dynamic -> HsAccReal Source #

inline alias of dot