Neuron Net
Macros | Functions
Pooling layer's neuron Gradients Calculation kernels

Describes the gradient calculation process for the Neuron of pooling layer. More...

Macros

#define def_k_CalcInputGradientProof   6
 Index of the kernel of the Pooling neuron to transfer gradient to previous layer (CalcInputGradientProof)
More...
 
#define def_k_cigp_matrix_i   0
 Inputs tesor. More...
 
#define def_k_cigp_matrix_g   1
 Tensor of gradients at current layer. More...
 
#define def_k_cigp_matrix_o   2
 Output tensor. More...
 
#define def_k_cigp_matrix_ig   3
 Tensor of gradients at previous layer. More...
 
#define def_k_cigp_outputs   4
 Number of outputs. More...
 
#define def_k_cigp_window   5
 Size of input window. More...
 
#define def_k_cigp_step   6
 Step size. More...
 

Functions

__kernel void CalcInputGradientProof (__global double *matrix_i, __global double *matrix_g, __global double *matrix_o, __global double *matrix_ig, int outputs, int window, int step)
 Kernel of the Pooling neuron to transfer gradient to previous layer (CNeuronProofOCL) More...
 

Detailed Description

Describes the gradient calculation process for the Neuron of pooling layer.

Macro Definition Documentation

◆ def_k_CalcInputGradientProof

#define def_k_CalcInputGradientProof   6

Index of the kernel of the Pooling neuron to transfer gradient to previous layer (CalcInputGradientProof)

Definition at line 159 of file NeuroNet.mqh.

◆ def_k_cigp_matrix_g

#define def_k_cigp_matrix_g   1

Tensor of gradients at current layer.

Definition at line 161 of file NeuroNet.mqh.

◆ def_k_cigp_matrix_i

#define def_k_cigp_matrix_i   0

Inputs tesor.

Definition at line 160 of file NeuroNet.mqh.

◆ def_k_cigp_matrix_ig

#define def_k_cigp_matrix_ig   3

Tensor of gradients at previous layer.

Definition at line 163 of file NeuroNet.mqh.

◆ def_k_cigp_matrix_o

#define def_k_cigp_matrix_o   2

Output tensor.

Definition at line 162 of file NeuroNet.mqh.

◆ def_k_cigp_outputs

#define def_k_cigp_outputs   4

Number of outputs.

Definition at line 164 of file NeuroNet.mqh.

◆ def_k_cigp_step

#define def_k_cigp_step   6

Step size.

Definition at line 166 of file NeuroNet.mqh.

◆ def_k_cigp_window

#define def_k_cigp_window   5

Size of input window.

Definition at line 165 of file NeuroNet.mqh.

Function Documentation

◆ CalcInputGradientProof()

__kernel void CalcInputGradientProof ( __global double *  matrix_i,
__global double *  matrix_g,
__global double *  matrix_o,
__global double *  matrix_ig,
int  outputs,
int  window,
int  step 
)

Kernel of the Pooling neuron to transfer gradient to previous layer (CNeuronProofOCL)

Parameters
[in]matrix_iInputs tesor
[in]matrix_gTensor of gradients at current layer
[in]matrix_oOutput tensor
[out]matrix_igTensor of gradients at previous layer
outputsNumber of outputs
windowSize of input window
stepStep size

Definition at line 299 of file NeuroNet.cl.

307  {
308  int i=get_global_id(0);
309  double prev_gradient=0;
310  double value=matrix_i[i];
311  int start=i-window+step;
312  start=(start-start%step)/step;
313  int stop=(i-i%step)/step+1;
314  for(int out=max(0,start); out<min(outputs,stop); out++)
315  {
316  if(value==matrix_o[out])
317  prev_gradient+=matrix_g[out];
318  }
319  matrix_ig[i]=prev_gradient;
320  }