nnlib
GPU-accelerated, C/C++ neural network library.
|
Header file declaring tensor operations that happen on device. More...
#include <tensor.h>
Functions | |
void | sumTensorOnDevice (const Tensor &tensor, Tensor &destination) |
void | fillTensorOnDevice (Tensor &tensor, float value) |
Fill a tensor with a constant value. More... | |
void | fillTensorOnDevice (Tensor &tensor, const Tensor &value) |
void | addTensorsOnDevice (const Tensor &a, const Tensor &b, Tensor &destination) |
Element-wise add two tensors. More... | |
void | subtractTensorsOnDevice (const Tensor &a, const Tensor &b, Tensor &destination) |
Subtract one tensor from another. More... | |
void | hadamardTensorsOnDevice (const Tensor &a, const Tensor &b, Tensor &destination) |
Perform hadamard product (element-wise multiplication) between two tensors. More... | |
void | divideTensorsOnDevice (const Tensor &a, const Tensor &b, Tensor &destination) |
Divide one tensor by another. More... | |
void | logTensorOnDevice (const Tensor &a, Tensor &destination) |
Apply natural logarithm to each element of the tensor. More... | |
void | addBroadcastOnDevice (const Tensor &matrix, const Tensor &vector, Tensor &destination) |
Perform the broadcast-add operation. More... | |
void | multiplyTensorOnDevice (const Tensor &tensor, float constant, Tensor &destination) |
Multiply a tensor with a constant. More... | |
void | multiplyMatrixVectorOnDevice (const Tensor &matrix, const Tensor &vector, Tensor &destination) |
Multiply a matrix with a vector. More... | |
void | multiplyMatrixMatrixOnDevice (const Tensor &m1, const Tensor &m2, Tensor &destination) |
Multiply a matrix with a matrix. More... | |
void | transposeMatrixOnDevice (const Tensor &matrix, Tensor &destination) |
Transpose a matrix. More... | |
void | reluTensorOnDevice (const Tensor &tensor, Tensor &destination) |
void | reluDerivativeTensorOnDevice (const Tensor &tensor, Tensor &destination) |
void | sigmoidTensorOnDevice (const Tensor &tensor, Tensor &destination) |
Header file declaring tensor operations that happen on device.
The methods declared in this file are only called when all operands are located on the GPU.
These methods do not perform any checking with regards to the size or location of the operands. This is already done in the corresponding methods in tensor.cpp.
Perform the broadcast-add operation.
matrix | The matrix tensor. |
vector | The vector tensor. |
destination | Where the result of the addition should be stored. |
Element-wise add two tensors.
a | The first tensor. |
b | The second tensor. |
destination | Where the result of the addition should be stored. |
Divide one tensor by another.
a | The tensor to divide. |
b | The tensor to divide by. |
destination | Where the result of the operation should be stored. |
void fillTensorOnDevice | ( | Tensor & | tensor, |
float | value | ||
) |
Fill a tensor with a constant value.
tensor | The tensor to fill. |
value | The value to fill the tensor with. |
Perform hadamard product (element-wise multiplication) between two tensors.
a | The first tensor. |
b | The second tensor. |
destination | Where the result of the operation should be stored. |
Apply natural logarithm to each element of the tensor.
a | The tensor to apply natural logarithm to. |
destination | Where the result of the operation should be stored. |
Multiply a matrix with a matrix.
m1 | The first matrix tensor. |
m2 | The second matrix tensor. |
destination | Where the result of the multiplication should be stored. |
void multiplyMatrixVectorOnDevice | ( | const Tensor & | matrix, |
const Tensor & | vector, | ||
Tensor & | destination | ||
) |
Multiply a matrix with a vector.
matrix | The matrix tensor. |
vector | The vector tensor. |
destination | Where the result of the multiplication should be stored. |
Multiply a tensor with a constant.
tensor | The tensor to multiply. |
constant | The constant to multiply with. |
destination | Where the result of the multiplication should be stored. |
Subtract one tensor from another.
a | The tensor to subtract from. |
b | The tensor to be subtracted. |
destination | Where the result of the subtraction should be stored. |