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.Pointwise

Description

Element-wise functions.

Synopsis

Documentation

cross Source #

Arguments

:: Dynamic

tensor a

-> Dynamic

tensor b (same size as tensor a in dimension below)

-> Word

dimension to operate over

-> Dynamic

new return tensor

returns the cross product of vectors in the specified dimension

a and b must have the same size, and both a:size(n) and b:size(n) must be 3.

sign_ :: Dynamic -> IO () Source #

Replaces all elements in-place with the sign of the elements of the tensor.

sign :: Dynamic -> Dynamic Source #

Returns a new Tensor with the sign (+/- 1) of the elements of a tensor

clamp_ :: Dynamic -> HsReal -> HsReal -> IO () Source #

Clamp all elements, inplace, in the tensor into the range [min_value, max_value]. ie:

        { min_value, if x_i < min_value
  y_i = { x_i,       if min_value ≤ x_i ≤ max_value
        { max_value, if x_i > max_value

clamp :: Dynamic -> HsReal -> HsReal -> Dynamic Source #

pure version of clamp_ returning a new tensor as output.

cadd_ Source #

Arguments

:: Dynamic

tensor1

-> HsReal

scale term to multiply againts tensor2

-> Dynamic

tensor2

-> IO () 

Multiply elements of tensor2 by the scalar value and add it to tensor1. The number of elements must match, but sizes do not matter.

Stores the result in tensor1.

cadd Source #

Arguments

:: Dynamic

tensor1

-> HsReal

scale term to multiply againts tensor2

-> Dynamic

tensor2

-> Dynamic 

Multiply elements of tensor2 by the scalar value and add it to tensor1. The number of elements must match, but sizes do not matter.

(^+^) :: Dynamic -> Dynamic -> Dynamic Source #

inline alias to cadd

csub_ Source #

Arguments

:: Dynamic

tensor1

-> HsReal

scale term to multiply againts tensor2

-> Dynamic

tensor2

-> IO () 

Multiply elements of tensor2 by the scalar value and subtract it from tensor1. The number of elements must match, but sizes do not matter.

Stores the result in tensor1.

csub Source #

Arguments

:: Dynamic

tensor1

-> HsReal

scale term to multiply againts tensor2

-> Dynamic

tensor2

-> Dynamic 

Multiply elements of tensor2 by the scalar value and subtract it from tensor1. The number of elements must match, but sizes do not matter.

(^-^) :: Dynamic -> Dynamic -> Dynamic Source #

inline alias to csub

cmul_ Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> IO () 

Performs the element-wise multiplication of tensor1 by tensor2. The number of elements must match, but sizes do not matter.

Stores the result in tensor1.

cmul Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> Dynamic 

Performs the element-wise multiplication of tensor1 by tensor2. The number of elements must match, but sizes do not matter.

(^*^) :: Dynamic -> Dynamic -> Dynamic Source #

inline alias to cmul

square :: Dynamic -> Dynamic Source #

square a tensor.

FIXME: this is a call to cmul but it might be better to use pow

cdiv_ Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> IO () 

Performs the element-wise division of tensor1 by tensor2. The number of elements must match, but sizes do not matter.

Stores the result in tensor1.

cdiv Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> Dynamic 

Performs the element-wise division of tensor1 by tensor2. The number of elements must match, but sizes do not matter.

(^/^) :: Dynamic -> Dynamic -> Dynamic Source #

inline alias to cdiv

cpow_ Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> IO () 

Element-wise power operation, taking the elements of tensor1 to the powers given by elements of tensor2. The number of elements must match, but sizes do not matter.

Stores the result in tensor1.

cpow Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> Dynamic 

Element-wise power operation, taking the elements of tensor1 to the powers given by elements of tensor2. The number of elements must match, but sizes do not matter.

clshift_ :: Dynamic -> Dynamic -> IO () Source #

Element-wise, inplace, bitwise left shift. Mutates the first argument.

clshift :: Dynamic -> Dynamic -> Dynamic Source #

Element-wise bitwise left shift.

crshift_ :: Dynamic -> Dynamic -> IO () Source #

Element-wise, inplace, bitwise right shift. Mutates the first argument.

crshift :: Dynamic -> Dynamic -> Dynamic Source #

Element-wise bitwise right shift.

cfmod_ Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> IO () 

Computes the element-wise remainder of the division (rounded towards zero) of tensor1 by tensor2. The number of elements must match, but sizes do not matter.

Stores the result in tensor1.

cfmod Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> Dynamic 

Computes the element-wise remainder of the division (rounded towards zero) of tensor1 by tensor2. The number of elements must match, but sizes do not matter.

cremainder_ Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> IO () 

Computes element-wise remainder of the division (rounded to nearest) of tensor1 by tensor2. The number of elements must match, but sizes do not matter.

Stores the result in tensor1.

cremainder Source #

Arguments

:: Dynamic

tensor1

-> Dynamic

tensor2

-> Dynamic 

Computes element-wise remainder of the division (rounded to nearest) of tensor1 by tensor2. The number of elements must match, but sizes do not matter.

cmax_ :: Dynamic -> Dynamic -> IO () Source #

Element-wise, inplace, max function -- storing the higher value. Mutates the first argument.

cmax :: Dynamic -> Dynamic -> Dynamic Source #

Element-wise max function -- keeping the higher value.

cmin_ :: Dynamic -> Dynamic -> IO () Source #

Element-wise, inplace, min function -- storing the lower value. Mutates the first argument.

cmin :: Dynamic -> Dynamic -> Dynamic Source #

Element-wise min function -- keeping the lower value.

cmaxValue_ :: Dynamic -> HsReal -> IO () Source #

Store the maximum of the tensor and a scalar in the input tensor on an element-by-element basis.

cmaxValue :: Dynamic -> HsReal -> Dynamic Source #

Store the maximum of the tensor and a scalar in a new tensor on an element-by-element basis.

cminValue_ :: Dynamic -> HsReal -> IO () Source #

Store the minimum of the tensor and a scalar in the input tensor on an element-by-element basis.

cminValue :: Dynamic -> HsReal -> Dynamic Source #

Store the minimum of the tensor and a scalar in a new tensor on an element-by-element basis.

cbitand_ :: Dynamic -> Dynamic -> IO () Source #

Element-wise, inplace, bitwise and. Mutates the first argument.

cbitand :: Dynamic -> Dynamic -> Dynamic Source #

Element-wise, bitwise and

cbitor_ :: Dynamic -> Dynamic -> IO () Source #

Element-wise, inplace, bitwise or. Mutates the first argument.

cbitor :: Dynamic -> Dynamic -> Dynamic Source #

Element-wise, bitwise or

cbitxor_ :: Dynamic -> Dynamic -> IO () Source #

Element-wise, inplace, bitwise xor. Mutates the first argument.

cbitxor :: Dynamic -> Dynamic -> Dynamic Source #

Element-wise, bitwise xor

addcmul_ Source #

Arguments

:: Dynamic

tensor0

-> HsReal

scale term

-> Dynamic

tensor1

-> Dynamic

tensor2

-> IO () 

Performs the element-wise multiplication of tensor1 by tensor2, multiplies the result by the scalar value and adds it to tensor0, which it mutates inplace.

The number of elements must match, but sizes do not matter.

addcmul Source #

Arguments

:: Dynamic

tensor0

-> HsReal

scale term

-> Dynamic

tensor1

-> Dynamic

tensor2

-> Dynamic 

Performs the element-wise multiplication of tensor1 by tensor2, multiplies the result by the scalar value and adds it to tensor0.

The number of elements must match, but sizes do not matter.

addcdiv_ Source #

Arguments

:: Dynamic

tensor0

-> HsReal

scale term

-> Dynamic

tensor1

-> Dynamic

tensor2

-> IO () 

Performs the element-wise multiplication of tensor1 by tensor2, multiplies the result by the scalar value and adds it to tensor0, which it mutates inplace.

The number of elements must match, but sizes do not matter.

addcdiv Source #

Arguments

:: Dynamic

tensor0

-> HsReal

scale term

-> Dynamic

tensor1

-> Dynamic

tensor2

-> Dynamic 

Performs the element-wise division of tensor1 by tensor2, multiplies the result by the scalar value and adds it to tensor0.

The number of elements must match, but sizes do not matter.