geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
Public Member Functions | Static Public Member Functions | List of all members
geopm::TensorMath Class Referenceabstract

Class to perform operations on 1D and 2D Tensors, aka vectors and matrices, suitable for use in feed-forward neural networks. More...

#include <TensorMath.hpp>

Inheritance diagram for geopm::TensorMath:
Inheritance graph
[legend]

Public Member Functions

virtual ~TensorMath ()=default
 
virtual TensorOneD add (const TensorOneD &tensor_a, const TensorOneD &tensor_b) const =0
 Add two 1D tensors of the same length, element-wise. More...
 
virtual TensorOneD subtract (const TensorOneD &tensor_a, const TensorOneD &tensor_b) const =0
 Subtract two 1D tensors of the same length, element-wise. More...
 
virtual double inner_product (const TensorOneD &tensor_a, const TensorOneD &tensor_b) const =0
 Multiply two 1D tensors, element-wise, and sum the result. More...
 
virtual TensorOneD sigmoid (const TensorOneD &tensor) const =0
 Compute logistic sigmoid function of 1D Tensor. More...
 
virtual TensorOneD multiply (const TensorTwoD &, const TensorOneD &) const =0
 Multiply a 2D tensor by a 1D tensor. More...
 

Static Public Member Functions

static std::shared_ptr< TensorMathmake_shared ()
 Returns a shared_ptr to a concrete object constructed using the underlying implementation. More...
 

Detailed Description

Class to perform operations on 1D and 2D Tensors, aka vectors and matrices, suitable for use in feed-forward neural networks.

Constructor & Destructor Documentation

◆ ~TensorMath()

virtual geopm::TensorMath::~TensorMath ( )
virtualdefault

Member Function Documentation

◆ add()

virtual TensorOneD geopm::TensorMath::add ( const TensorOneD tensor_a,
const TensorOneD tensor_b 
) const
pure virtual

Add two 1D tensors of the same length, element-wise.

Exceptions
geopm::Exceptionif the lengths do not match.
Parameters
[in]otherThe summand
Returns
Returns a 1D tensor, the sum of two 1D tensors

Implemented in geopm::TensorMathImp.

◆ inner_product()

virtual double geopm::TensorMath::inner_product ( const TensorOneD tensor_a,
const TensorOneD tensor_b 
) const
pure virtual

Multiply two 1D tensors, element-wise, and sum the result.

Exceptions
geopm::Exceptionif the lengths do not match.
Parameters
[in]otherThe multiplicand
Returns
Returns a 1D tensor, the product of two 1D tensors

Implemented in geopm::TensorMathImp.

◆ make_shared()

std::shared_ptr< TensorMath > geopm::TensorMath::make_shared ( void  )
static

Returns a shared_ptr to a concrete object constructed using the underlying implementation.

◆ multiply()

virtual TensorOneD geopm::TensorMath::multiply ( const TensorTwoD ,
const TensorOneD  
) const
pure virtual

Multiply a 2D tensor by a 1D tensor.

Parameters
[in]TensorTwoD&Reference to the 2D multiplicand
[in]TensorOneD&Reference to the 1D multiplicand
Exceptions
geopm::Exceptionif the sizes are incompatible, i.e. if 2D tensor number of columns is unequal to 1D tensor number of rows

Implemented in geopm::TensorMathImp.

◆ sigmoid()

virtual TensorOneD geopm::TensorMath::sigmoid ( const TensorOneD tensor) const
pure virtual

Compute logistic sigmoid function of 1D Tensor.

Implemented in geopm::TensorMathImp.

◆ subtract()

virtual TensorOneD geopm::TensorMath::subtract ( const TensorOneD tensor_a,
const TensorOneD tensor_b 
) const
pure virtual

Subtract two 1D tensors of the same length, element-wise.

Exceptions
geopm::Exceptionif the lengths do not match.
Parameters
[in]otherThe subtrahend
Returns
A 1D tensor, the difference of two 1D tensors.

Implemented in geopm::TensorMathImp.


The documentation for this class was generated from the following files: