Neuron Net
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CNeuronConvOCL Class Reference

Class of convolution layer GPU calculation. More...

Inheritance diagram for CNeuronConvOCL:
CNeuronProofOCL CNeuronBaseOCL

Public Member Functions

 CNeuronConvOCL (void)
 Constructor. More...
 
 ~CNeuronConvOCL (void)
 Destructor. More...
 
virtual bool Init (uint numOutputs, uint myIndex, COpenCLMy *open_cl, uint window, uint step, uint window_out, uint units_count, ENUM_OPTIMIZATION optimization_type)
 Method of initialization class. More...
 
virtual bool SetGradientIndex (int index)
 Method for change index of gradient buffer. More...
 
virtual bool calcInputGradients (CNeuronBaseOCL *NeuronOCL)
 Method to transfer gradients to previous layer. More...
 
virtual int Type (void) const
 Identificator of class. More...
 
virtual bool Save (int const file_handle)
 Save method. More...
 
virtual bool Load (int const file_handle)
 Load method. More...
 
virtual bool Init (uint numOutputs, uint myIndex, COpenCLMy *open_cl, int window, int step, int units_count, ENUM_OPTIMIZATION optimization_type)
 Method of initialization class. More...
 
virtual bool Init (uint numOutputs, uint myIndex, COpenCLMy *open_cl, uint numNeurons, ENUM_OPTIMIZATION optimization_type)
 Method of initialization class. More...
 
virtual void SetActivationFunction (ENUM_ACTIVATION value)
 Set the type of activation function (ENUM_ACTIVATION) More...
 
virtual int getOutputIndex (void)
 Get index of output buffer. More...
 
virtual int getPrevOutIndex (void)
 Get index of previous iteration output buffer. More...
 
virtual int getGradientIndex (void)
 Get index of gradient buffer. More...
 
virtual int getWeightsIndex (void)
 Get index of weights matrix buffer. More...
 
virtual int getDeltaWeightsIndex (void)
 Get index of delta weights matrix buffer (SGD) More...
 
virtual int getFirstMomentumIndex (void)
 Get index of first momentum matrix buffer (Adam) More...
 
virtual int getSecondMomentumIndex (void)
 Get index of Second momentum matrix buffer (Adam) More...
 
virtual int getOutputVal (double &values[])
 Get values of output buffer. More...
 
virtual int getOutputVal (CArrayDouble *values)
 Get values of output buffer. More...
 
virtual int getPrevVal (double &values[])
 Get values of previous iteration output buffer. More...
 
virtual int getGradient (double &values[])
 Get values of gradient buffer. More...
 
virtual int getWeights (double &values[])
 Get values of weights matrix buffer. More...
 
virtual int Neurons (void)
 Get number of neurons in layer. More...
 
virtual int Activation (void)
 Get type of activation function. More...
 
virtual int getConnections (void)
 Get number of connections 1 neuron to next layer. More...
 
virtual bool FeedForward (CObject *SourceObject)
 Dispatch method for defining the subroutine for feed forward process. More...
 
virtual bool calcHiddenGradients (CObject *TargetObject)
 Dispatch method for defining the subroutine for transferring the gradient to the previous layer. More...
 
virtual bool calcHiddenGradients (CNeuronBaseOCL *NeuronOCL)
 Method to transfer gradient to previous layer. More...
 
virtual bool calcOutputGradients (CArrayDouble *Target)
 Method of output gradients calculation. More...
 
virtual bool UpdateInputWeights (CObject *SourceObject)
 Dispatch method for defining the subroutine for updating weights. More...
 

Protected Member Functions

virtual bool feedForward (CNeuronBaseOCL *NeuronOCL)
 Feed Forward method. More...
 
virtual bool updateInputWeights (CNeuronBaseOCL *NeuronOCL)
 Method for updating weights. More...
 

Protected Attributes

uint iWindowOut
 Size of out window. More...
 
CBufferDoubleWeightsConv
 Matrix of weights to previous layer. More...
 
CBufferDoubleDeltaWeightsConv
 Matrix of delta weights to previous layer (SGD) More...
 
CBufferDoubleFirstMomentumConv
 Matrix of first momentum to previous layer (ADAM) More...
 
CBufferDoubleSecondMomentumConv
 Matrix of second momentum to previous layer (ADAM) More...
 
uint iWindow
 Input window size. More...
 
uint iStep
 Size of step. More...
 
COpenCLMyOpenCL
 Object for working with OpenCL. More...
 
CBufferDoubleOutput
 Buffer of Output tenzor. More...
 
CBufferDoublePrevOutput
 Buffer of previous iteration Output tenzor. More...
 
CBufferDoubleWeights
 Buffer of weights matrix. More...
 
CBufferDoubleDeltaWeights
 Buffer of last delta weights matrix (SGD) More...
 
CBufferDoubleGradient
 Buffer of gradient tenzor. More...
 
CBufferDoubleFirstMomentum
 Buffer of first momentum matrix (ADAM) More...
 
CBufferDoubleSecondMomentum
 Buffer of second momentum matrix (ADAM) More...
 
const double alpha
 Multiplier to momentum in SGD optimization. More...
 
int t
 Count of iterations. More...
 
int m_myIndex
 Index of neuron in layer. More...
 
ENUM_ACTIVATION activation
 Activation type (ENUM_ACTIVATION) More...
 
ENUM_OPTIMIZATION optimization
 Optimization method (ENUM_OPTIMIZATION) More...
 

Detailed Description

Class of convolution layer GPU calculation.

Detailed description on the link.

Definition at line 3630 of file NeuroNet.mqh.

Constructor & Destructor Documentation

◆ CNeuronConvOCL()

CNeuronConvOCL::CNeuronConvOCL ( void  )
inline

Constructor.

Definition at line 3644 of file NeuroNet.mqh.

◆ ~CNeuronConvOCL()

CNeuronConvOCL::~CNeuronConvOCL ( void  )

Destructor.

Definition at line 3660 of file NeuroNet.mqh.

Member Function Documentation

◆ Activation()

virtual int CNeuronBaseOCL::Activation ( void  )
inlinevirtualinherited

Get type of activation function.

Returns
Type (ENUM_ACTIVATION)

Definition at line 2969 of file NeuroNet.mqh.

◆ calcHiddenGradients() [1/2]

bool CNeuronBaseOCL::calcHiddenGradients ( CNeuronBaseOCL NeuronOCL)
virtualinherited

Method to transfer gradient to previous layer.

Parameters
NeuronOCLPointer to next layer.

Definition at line 3197 of file NeuroNet.mqh.

◆ calcHiddenGradients() [2/2]

bool CNeuronBaseOCL::calcHiddenGradients ( CObject *  TargetObject)
virtualinherited

Dispatch method for defining the subroutine for transferring the gradient to the previous layer.

Parameters
TargetObjectPointer to the next layer.

Definition at line 3321 of file NeuroNet.mqh.

◆ calcInputGradients()

bool CNeuronConvOCL::calcInputGradients ( CNeuronBaseOCL NeuronOCL)
virtual

Method to transfer gradients to previous layer.

Parameters
[in]NeuronOCLPointer to previous layer.

Reimplemented from CNeuronProofOCL.

Definition at line 3773 of file NeuroNet.mqh.

◆ calcOutputGradients()

bool CNeuronBaseOCL::calcOutputGradients ( CArrayDouble *  Target)
virtualinherited

Method of output gradients calculation.

Parameters
TargetTraget value

Definition at line 3230 of file NeuroNet.mqh.

◆ feedForward()

bool CNeuronConvOCL::feedForward ( CNeuronBaseOCL NeuronOCL)
protectedvirtual

Feed Forward method.

Parameters
NeuronOCLPointer to previos layer.

Reimplemented from CNeuronProofOCL.

Definition at line 3747 of file NeuroNet.mqh.

◆ FeedForward()

bool CNeuronBaseOCL::FeedForward ( CObject *  SourceObject)
virtualinherited

Dispatch method for defining the subroutine for feed forward process.

Parameters
SourceObjectPointer to the previous layer.

Definition at line 3144 of file NeuroNet.mqh.

◆ getConnections()

virtual int CNeuronBaseOCL::getConnections ( void  )
inlinevirtualinherited

Get number of connections 1 neuron to next layer.

Returns
Number of connections

Definition at line 2970 of file NeuroNet.mqh.

◆ getDeltaWeightsIndex()

virtual int CNeuronBaseOCL::getDeltaWeightsIndex ( void  )
inlinevirtualinherited

Get index of delta weights matrix buffer (SGD)

Returns
Index

Definition at line 2959 of file NeuroNet.mqh.

◆ getFirstMomentumIndex()

virtual int CNeuronBaseOCL::getFirstMomentumIndex ( void  )
inlinevirtualinherited

Get index of first momentum matrix buffer (Adam)

Returns
Index

Definition at line 2960 of file NeuroNet.mqh.

◆ getGradient()

virtual int CNeuronBaseOCL::getGradient ( double &  values[])
inlinevirtualinherited

Get values of gradient buffer.

Parameters
[out]valuesArray of data
Returns
number of items

Definition at line 2966 of file NeuroNet.mqh.

◆ getGradientIndex()

virtual int CNeuronBaseOCL::getGradientIndex ( void  )
inlinevirtualinherited

Get index of gradient buffer.

Returns
Index

Definition at line 2957 of file NeuroNet.mqh.

◆ getOutputIndex()

virtual int CNeuronBaseOCL::getOutputIndex ( void  )
inlinevirtualinherited

Get index of output buffer.

Returns
Index

Definition at line 2955 of file NeuroNet.mqh.

◆ getOutputVal() [1/2]

virtual int CNeuronBaseOCL::getOutputVal ( CArrayDouble *  values)
inlinevirtualinherited

Get values of output buffer.

Parameters
[out]valuesArray of data
Returns
number of items

Definition at line 2964 of file NeuroNet.mqh.

◆ getOutputVal() [2/2]

virtual int CNeuronBaseOCL::getOutputVal ( double &  values[])
inlinevirtualinherited

Get values of output buffer.

Parameters
[out]valuesArray of data
Returns
number of items

Definition at line 2963 of file NeuroNet.mqh.

◆ getPrevOutIndex()

virtual int CNeuronBaseOCL::getPrevOutIndex ( void  )
inlinevirtualinherited

Get index of previous iteration output buffer.

Returns
Index

Definition at line 2956 of file NeuroNet.mqh.

◆ getPrevVal()

virtual int CNeuronBaseOCL::getPrevVal ( double &  values[])
inlinevirtualinherited

Get values of previous iteration output buffer.

Parameters
[out]valuesArray of data
Returns
number of items

Definition at line 2965 of file NeuroNet.mqh.

◆ getSecondMomentumIndex()

virtual int CNeuronBaseOCL::getSecondMomentumIndex ( void  )
inlinevirtualinherited

Get index of Second momentum matrix buffer (Adam)

Returns
Index

Definition at line 2961 of file NeuroNet.mqh.

◆ getWeights()

virtual int CNeuronBaseOCL::getWeights ( double &  values[])
inlinevirtualinherited

Get values of weights matrix buffer.

Parameters
[out]valuesArray of data
Returns
number of items

Definition at line 2967 of file NeuroNet.mqh.

◆ getWeightsIndex()

virtual int CNeuronBaseOCL::getWeightsIndex ( void  )
inlinevirtualinherited

Get index of weights matrix buffer.

Returns
Index

Definition at line 2958 of file NeuroNet.mqh.

◆ Init() [1/3]

bool CNeuronProofOCL::Init ( uint  numOutputs,
uint  myIndex,
COpenCLMy open_cl,
int  window,
int  step,
int  units_count,
ENUM_OPTIMIZATION  optimization_type 
)
virtualinherited

Method of initialization class.

Parameters
[in]numOutputsNumber of connections to next layer.
[in]myIndexIndex of neuron in layer.
[in]open_clPointer to COpenCLMy object.
[in]windowSize of input window
[in]stepStep size.
[in]units_countNumberof neurons.
[in]optimization_typeOptimization type (ENUM_OPTIMIZATION)
Returns
Boolen result of operations.

Definition at line 3559 of file NeuroNet.mqh.

◆ Init() [2/3]

bool CNeuronBaseOCL::Init ( uint  numOutputs,
uint  myIndex,
COpenCLMy open_cl,
uint  numNeurons,
ENUM_OPTIMIZATION  optimization_type 
)
virtualinherited

Method of initialization class.

Parameters
[in]numOutputsNumber of connections to next layer.
[in]myIndexIndex of neuron in layer.
[in]open_clPointer to COpenCLMy object. #param[in] numNeurons Number of neurons in layer
optimization_typeOptimization type (ENUM_OPTIMIZATION)
Returns
Boolen result of operations.

Definition at line 3024 of file NeuroNet.mqh.

◆ Init() [3/3]

bool CNeuronConvOCL::Init ( uint  numOutputs,
uint  myIndex,
COpenCLMy open_cl,
uint  window,
uint  step,
uint  window_out,
uint  units_count,
ENUM_OPTIMIZATION  optimization_type 
)
virtual

Method of initialization class.

Parameters
[in]numOutputsNumber of connections to next layer.
[in]myIndexIndex of neuron in layer.
[in]open_clPointer to COpenCLMy object.
[in]windowSize of input window
[in]stepStep size.
[in]window_outSize of output window
[in]units_countNumberof neurons.
[in]optimization_typeOptimization type (ENUM_OPTIMIZATION)
Returns
Boolen result of operations.

Definition at line 3674 of file NeuroNet.mqh.

◆ Load()

bool CNeuronConvOCL::Load ( int const  file_handle)
virtual

Load method.

Parameters
[in]file_handlehandle of file
Returns
logical result of operation

Reimplemented from CNeuronProofOCL.

Definition at line 4378 of file NeuroNet.mqh.

◆ Neurons()

virtual int CNeuronBaseOCL::Neurons ( void  )
inlinevirtualinherited

Get number of neurons in layer.

Returns
Number of neurons

Definition at line 2968 of file NeuroNet.mqh.

◆ Save()

bool CNeuronConvOCL::Save ( int const  file_handle)
virtual

Save method.

Parameters
[in]file_handlehandle of file
Returns
logical result of operation

Reimplemented from CNeuronProofOCL.

Definition at line 4430 of file NeuroNet.mqh.

◆ SetActivationFunction()

virtual void CNeuronBaseOCL::SetActivationFunction ( ENUM_ACTIVATION  value)
inlinevirtualinherited

Set the type of activation function (ENUM_ACTIVATION)

Definition at line 2953 of file NeuroNet.mqh.

◆ SetGradientIndex()

virtual bool CNeuronConvOCL::SetGradientIndex ( int  index)
inlinevirtual

Method for change index of gradient buffer.

Parameters
[in]Newindex of buffer

Definition at line 3649 of file NeuroNet.mqh.

◆ Type()

virtual int CNeuronConvOCL::Type ( void  ) const
inlinevirtual

Identificator of class.

Returns
Type of class

Reimplemented from CNeuronProofOCL.

Definition at line 3652 of file NeuroNet.mqh.

◆ updateInputWeights()

bool CNeuronConvOCL::updateInputWeights ( CNeuronBaseOCL NeuronOCL)
protectedvirtual

Method for updating weights.

Parameters
NeuronOCLPointer to previos layer.

Reimplemented from CNeuronBaseOCL.

Definition at line 3801 of file NeuroNet.mqh.

◆ UpdateInputWeights()

bool CNeuronBaseOCL::UpdateInputWeights ( CObject *  SourceObject)
virtualinherited

Dispatch method for defining the subroutine for updating weights.

Parameters
SourceObjectPointer to previos layer.

Definition at line 3352 of file NeuroNet.mqh.

Member Data Documentation

◆ activation

ENUM_ACTIVATION CNeuronBaseOCL::activation
protectedinherited

Activation type (ENUM_ACTIVATION)

Definition at line 2939 of file NeuroNet.mqh.

◆ alpha

const double CNeuronBaseOCL::alpha
protectedinherited

Multiplier to momentum in SGD optimization.

Definition at line 2935 of file NeuroNet.mqh.

◆ DeltaWeights

CBufferDouble* CNeuronBaseOCL::DeltaWeights
protectedinherited

Buffer of last delta weights matrix (SGD)

Definition at line 2929 of file NeuroNet.mqh.

◆ DeltaWeightsConv

CBufferDouble* CNeuronConvOCL::DeltaWeightsConv
protected

Matrix of delta weights to previous layer (SGD)

Definition at line 3636 of file NeuroNet.mqh.

◆ FirstMomentum

CBufferDouble* CNeuronBaseOCL::FirstMomentum
protectedinherited

Buffer of first momentum matrix (ADAM)

Definition at line 2931 of file NeuroNet.mqh.

◆ FirstMomentumConv

CBufferDouble* CNeuronConvOCL::FirstMomentumConv
protected

Matrix of first momentum to previous layer (ADAM)

Definition at line 3637 of file NeuroNet.mqh.

◆ Gradient

CBufferDouble* CNeuronBaseOCL::Gradient
protectedinherited

Buffer of gradient tenzor.

Definition at line 2930 of file NeuroNet.mqh.

◆ iStep

uint CNeuronProofOCL::iStep
protectedinherited

Size of step.

Definition at line 3540 of file NeuroNet.mqh.

◆ iWindow

uint CNeuronProofOCL::iWindow
protectedinherited

Input window size.

Definition at line 3539 of file NeuroNet.mqh.

◆ iWindowOut

uint CNeuronConvOCL::iWindowOut
protected

Size of out window.

Definition at line 3633 of file NeuroNet.mqh.

◆ m_myIndex

int CNeuronBaseOCL::m_myIndex
protectedinherited

Index of neuron in layer.

Definition at line 2938 of file NeuroNet.mqh.

◆ OpenCL

COpenCLMy* CNeuronBaseOCL::OpenCL
protectedinherited

Object for working with OpenCL.

Definition at line 2925 of file NeuroNet.mqh.

◆ optimization

ENUM_OPTIMIZATION CNeuronBaseOCL::optimization
protectedinherited

Optimization method (ENUM_OPTIMIZATION)

Definition at line 2940 of file NeuroNet.mqh.

◆ Output

CBufferDouble* CNeuronBaseOCL::Output
protectedinherited

Buffer of Output tenzor.

Definition at line 2926 of file NeuroNet.mqh.

◆ PrevOutput

CBufferDouble* CNeuronBaseOCL::PrevOutput
protectedinherited

Buffer of previous iteration Output tenzor.

Definition at line 2927 of file NeuroNet.mqh.

◆ SecondMomentum

CBufferDouble* CNeuronBaseOCL::SecondMomentum
protectedinherited

Buffer of second momentum matrix (ADAM)

Definition at line 2932 of file NeuroNet.mqh.

◆ SecondMomentumConv

CBufferDouble* CNeuronConvOCL::SecondMomentumConv
protected

Matrix of second momentum to previous layer (ADAM)

Definition at line 3638 of file NeuroNet.mqh.

◆ t

int CNeuronBaseOCL::t
protectedinherited

Count of iterations.

Definition at line 2936 of file NeuroNet.mqh.

◆ Weights

CBufferDouble* CNeuronBaseOCL::Weights
protectedinherited

Buffer of weights matrix.

Definition at line 2928 of file NeuroNet.mqh.

◆ WeightsConv

CBufferDouble* CNeuronConvOCL::WeightsConv
protected

Matrix of weights to previous layer.

Definition at line 3635 of file NeuroNet.mqh.


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