nnlib
GPU-accelerated, C/C++ neural network library.
|
Header file declaring tensor operations that happen on host. More...
#include <tensor.h>
Go to the source code of this file.
Functions | |
void | sumTensorOnHost (const Tensor &tensor, Tensor &destination) |
Sum all values of a tensor. More... | |
void | fillTensorOnHost (Tensor &tensor, float value) |
Fill a tensor with a constant value. More... | |
void | fillTensorOnHost (Tensor &tensor, const Tensor &value) |
void | addTensorsOnHost (const Tensor &a, const Tensor &b, Tensor &destination) |
Element-wise add two tensors. More... | |
void | subtractTensorsOnHost (const Tensor &a, const Tensor &b, Tensor &destination) |
Subtract one tensor from another. More... | |
void | hadamardTensorsOnHost (const Tensor &a, const Tensor &b, Tensor &destination) |
Perform hadamard product (element-wise multiplication) between two tensors. More... | |
void | divideTensorsOnHost (const Tensor &a, const Tensor &b, Tensor &destination) |
Divide one tensor by another. More... | |
void | logTensorOnHost (const Tensor &a, Tensor &destination) |
Apply natural logarithm to each element of the tensor. More... | |
void | addBroadcastOnHost (const Tensor &matrix, const Tensor &vector, Tensor &destination) |
Perform the broadcast-add operation. More... | |
void | multiplyTensorOnHost (const Tensor &tensor, float constant, Tensor &destination) |
Multiply a tensor with a constant. More... | |
void | multiplyMatrixVectorOnHost (const Tensor &matrix, const Tensor &vector, Tensor &destination) |
Multiply a matrix with a vector. More... | |
void | multiplyMatrixMatrixOnHost (const Tensor &m1, const Tensor &m2, Tensor &destination) |
Multiply a matrix with a matrix. More... | |
void | transposeMatrixOnHost (const Tensor &matrix, Tensor &destination) |
Transpose a matrix. More... | |
void | reluTensorOnHost (const Tensor &tensor, Tensor &destination) |
void | reluDerivativeTensorOnHost (const Tensor &tensor, Tensor &destination) |
void | sigmoidTensorOnHost (const Tensor &tensor, Tensor &destination) |
Header file declaring tensor operations that happen on host.
The methods declared in this file are only called when all operands are located on the CPU.
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 fillTensorOnHost | ( | 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 multiplyMatrixVectorOnHost | ( | 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. |
Sum all values of a tensor.
tensor | The tensor to sum. |