Neural Networks

Base

Functions

void hl_shrink_col2feature(const real *dataCol, size_t channels, size_t height, size_t width, size_t blockH, size_t blockW, size_t strideH, size_t strideW, size_t paddingH, size_t paddingW, size_t outputH, size_t outputW, real *dataIm, real alpha = 1.0f, real beta = 0.0f)

Shrink column to feature.

Parameters
  • dataCol -

    expand data.

  • channels -

    number of channel.

  • height -

    image height.

  • width -

    image width.

  • blockH -

    filter height.

  • blockW -

    filter width.

  • strideH -

    stride height.

  • strideW -

    stride width.

  • paddingH -

    padding height.

  • paddingW -

    padding width.

  • outputH -

    output height.

  • outputW -

    output width.

  • dataIm -

    output image data.

  • alpha -

  • beta -

void hl_expand_feature2col(const real *dataIm, size_t channels, size_t height, size_t width, size_t blockH, size_t blockW, size_t strideH, size_t strideW, size_t paddingH, size_t paddingW, size_t outputH, size_t outputW, real *dataCol)

Expand feature to column.

Parameters
  • dataIm -

    input image data.

  • channels -

    number of channel.

  • height -

    image height.

  • width -

    image width.

  • blockH -

    filter height.

  • blockW -

    filter width.

  • strideH -

    stride height.

  • strideW -

    stride width.

  • paddingH -

    padding height.

  • paddingW -

    padding width.

  • outputH -

    output height.

  • outputW -

    output width.

  • dataCol -

    expand data.

void hl_maxpool_forward(int frameCnt, const real *inputData, int channels, int height, int width, int pooledH, int pooledW, int sizeX, int stride, int start, real *tgtData)

Maximum pool forward.

Parameters
  • frameCnt -

    batch size of input image.

  • inputData -

    input data.

  • channels -

    number of channel.

  • height -

    image height.

  • width -

    image width.

  • pooledH -

    output image height.

  • pooledW -

    output image width.

  • sizeX -

    size of pooling window.

  • stride -

    pooling stride.

  • start -

    pooling start.

  • tgtData -

    output data.

void hl_maxpool_backward(int frameCnt, const real *inputData, const real *outData, const real *outGrad, int channels, int height, int width, int pooledH, int pooledW, int sizeX, int stride, int start, real *targetGrad, real scaleA, real scaleB)

Maximum pool backward.

Parameters
  • frameCnt -

    batch size of input image.

  • inputData -

    input data.

  • outData -

    output data.

  • outGrad -

    output grad data.

  • channels -

    number of channel.

  • height -

    image height.

  • width -

    image width.

  • pooledH -

    output image height.

  • pooledW -

    output image width.

  • sizeX -

    size of pooling window.

  • stride -

    pooling stride.

  • start -

    pooling start.

  • targetGrad -

    output grad.

  • scaleA -

    scale.

  • scaleB -

    scale.

void hl_avgpool_forward(int frameCnt, const real *inputData, int channels, int height, int width, int pooledH, int pooledW, int sizeX, int stride, int start, real *tgtData)

Averge pool forward.

Parameters
  • frameCnt -

    batch size of input image.

  • inputData -

    input data.

  • channels -

    number of channel.

  • height -

    image height.

  • width -

    image width.

  • pooledH -

    output image height.

  • pooledW -

    output image width.

  • sizeX -

    size of pooling window.

  • stride -

    pooling stride.

  • start -

    pooling start.

  • tgtData -

    output data.

void hl_avgpool_backward(int frameCnt, const real *outGrad, int channels, int height, int width, int pooledH, int pooledW, int sizeX, int stride, int start, real *backGrad, real scaleA, real scaleB)

Maximum pool backward.

Parameters
  • frameCnt -

    batch size of input image.

  • outGrad -

    input data.

  • channels -

    number of channel.

  • height -

    image height.

  • width -

    image width.

  • pooledH -

    output image height.

  • pooledW -

    output image width.

  • sizeX -

    size of pooling window.

  • stride -

    pooling stride.

  • start -

    pooling start.

  • backGrad -

    output grad.

  • scaleA -

    scale.

  • scaleB -

    scale.

void hl_CMRNorm_forward(size_t frameCnt, const real *in, real *scale, real *out, size_t channels, size_t height, size_t width, size_t sizeX, real alpha, real beta)

Cross-map-respose normalize forward.

Parameters
  • frameCnt -

    batch size of input image.

  • in -

    input data.

  • scale -

    buffer.

  • out -

    output data.

  • channels -

    number of channel.

  • height -

    image height.

  • width -

    image width.

  • sizeX -

    size.

  • alpha -

    scale.

  • beta -

    scale.

void hl_CMRNorm_backward(size_t frameCnt, const real *inV, const real *scale, const real *outV, const real *outDiff, real *inDiff, size_t channels, size_t height, size_t width, size_t sizeX, real alpha, real beta)

Cross-map-respose normalize backward.

Parameters
  • frameCnt -

    batch size of input image.

  • inV -

    input data.

  • scale -

    buffer.

  • outV -

    output value.

  • outDiff -

    output grad.

  • inDiff -

    input grad.

  • channels -

    number of channel.

  • height -

    image height.

  • width -

    image width.

  • sizeX -

    size.

  • alpha -

    scale.

  • beta -

    scale.

Defines

SIGMOID_THRESHOLD_MIN

sigmoid threshold maximum

SIGMOID_THRESHOLD_MAX

sigmoid threshold minimum

namespace hppl

Functions

real relu(const real a)
real sigmoid(const real a)
real tanh(const real a)
real linear(const real a)
real relu(const real a, const real b)
real sigmoid(const real a, const real b)
real tanh(const real a, const real b)
real linear(const real a, const real b)
namespace hppl

Functions

__m256 relu(const __m256 a)
__m256 sigmoid(const __m256 a)
__m256 tanh(const __m256 a)
__m256 linear(const __m256 a)
__m256 relu(const __m256 a, const __m256 b)
__m256 sigmoid(const __m256 a, const __m256 b)
__m256 tanh(const __m256 a, const __m256 b)
__m256 linear(const __m256 a, const __m256 b)

Defines

HL_DEVICE_FUNCTIONS_CUH_
namespace paddle

Functions

template <class T>
__device__ T paddle::paddleAtomicAdd(T * address, T val)
template <>
__device__ float paddle::paddleAtomicAdd(float * address, float val)
template <>
__device__ double paddle::paddleAtomicAdd(double * address, double val)

Defines

HL_GPU_FUNCTIONS_CUH_

Activation Functions

Defines

HPPL_ACTIVE_FUNCTION

Active functions: sigmoid, relu, tanh and linear.

namespace hppl
template <class T>
class Active
#include <hl_activation_functions.h>

Hppl supports sigmoid, relu, tanh, linear active functions for neural networks’ forward and backward activation.

Public Types

typedef >
typedef T (*hppl::Active<T>::forward)(T)
typedef >
typedef T (*hppl::Active<T>::backward)(T, T)
namespace cpu

Variables

Active<real>::forward forward[]
Active<real>::backward backward[]