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
(const int frameCnt, const real *inputData, const int channels, const int height, const int width, const int pooledH, const int pooledW, const int sizeX, const int sizeY, const int strideH, const int strideW, const int paddingH, const int paddingW, real *tgtData, const int tgtStride)¶ 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
: width of pooling window.sizeY
: height of pooling window.strideH
: pooling stride height.strideW
: pooling stride width.paddingH
: padding height.paddingW
: padding width.tgtData
: output data.tgtStride
: stride between output data samples.
-
void
hl_maxpool_backward
(const int frameCnt, const real *inputData, const real *outData, const real *outGrad, const int channels, const int height, const int width, const int pooledH, const int pooledW, const int sizeX, const int sizeY, const int strideH, const int strideW, const int paddingH, const int paddingW, real scaleA, real scaleB, real *targetGrad, const int outStride)¶ 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
: width of pooling window.sizeY
: height of pooling window.strideH
: pooling stride height.strideW
: pooling stride width.scaleA
: scale.scaleB
: scale.paddingH
: padding height.paddingW
: padding width.targetGrad
: output grad.outStride
: stride between output data samples.
-
void
hl_avgpool_forward
(const int frameCnt, const real *inputData, const int channels, const int height, const int width, const int pooledH, const int pooledW, const int sizeX, const int sizeY, const int strideH, const int strideW, const int paddingH, const int paddingW, real *tgtData, const int tgtStride)¶ 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
: width of pooling window.sizeY
: height of pooling window.strideH
: pooling stride height.strideW
: pooling stride width.paddingH
: padding height.paddingW
: padding width.tgtData
: output data.tgtStride
: stride between output data samples.
-
void
hl_avgpool_backward
(const int frameCnt, const real *outGrad, const int channels, const int height, const int width, const int pooledH, const int pooledW, const int sizeX, const int sizeY, const int strideH, const int strideW, int paddingH, int paddingW, real scaleA, real scaleB, real *backGrad, const int outStride)¶ Maximum pool backward.
- Parameters
frameCnt
: batch size of input image.outGrad
: output grad data.channels
: number of channel.height
: image height.width
: image width.pooledH
: output image height.pooledW
: output image width.sizeX
: width of pooling window.sizeY
: height of pooling window.strideH
: pooling stride height.strideW
: pooling stride width.paddingH
: padding height.paddingW
: padding width.scaleA
: scale.scaleB
: scale.backGrad
: output grad.outStride
: stride between output data samples.
-
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.
-
void
hl_bilinear_forward
(const real *inData, const size_t inImgH, const size_t inImgW, const size_t inputH, const size_t inputW, real *outData, const size_t outImgH, const size_t outImgW, const size_t outputH, const size_t outputW, const size_t numChannels, const real ratioH, const real ratioW)¶ Bilinear interpolation forward.
- Parameters
inData
: input value.inImgH
: input image height.inImgW
: input image width.inputH
: input batchSize.inputW
: input image data dim.outData
: output value.outImgH
: output image height.outImgW
: output image width.outputH
: output batchSize.outputW
: output image data dim.numChannels
: number of channels.ratioH
: inImgH / outImgH.ratioW
: inImgW / outImgW.
-
void
hl_bilinear_backward
(real *inGrad, const size_t inImgH, const size_t inImgW, const size_t inputH, const size_t inputW, const real *outGrad, const size_t outImgH, const size_t outImgW, const size_t outputH, const size_t outputW, const size_t numChannels, const real ratioH, const real ratioW)¶ Bilinear interpolation backward.
- Parameters
inGrad
: input gradient.inImgH
: input image height.inImgW
: input image width.inputH
: input batchSize.inputW
: input image data dim.outGrad
: output gradient.outImgH
: output image height.outImgW
: output image width.outputH
: output batchSize.outputW
: output image data dim.numChannels
: number of channels.ratioH
: inImgH / outImgH.ratioW
: inImgW / outImgW.
-
void
hl_maxout_forward
(const real *inData, real *outData, int *idData, size_t batchSize, size_t size, size_t featLen, size_t groups)¶ MaxOut forward.
- Parameters
inData
: input data.outData
: output data.idData
: output maxId.batchSize
: batchSize.size
: number of channels * image height * image width.featLen
: feature length = image height * image width.groups
: number of groups.
-
void
hl_maxout_backward
(real *inGrad, const real *outGrad, const int *idData, size_t batchSize, size_t size, size_t featLen, size_t groups)¶ MaxOut backward.
- Parameters
inGrad
: input grad data.outGrad
: output grad data.idData
: output maxId.batchSize
: batchSize.size
: number of channels * image height * image width.featLen
: feature length = image height * image width.groups
: number of groups.
Defines
-
SIGMOID_THRESHOLD_MIN
¶ sigmoid threshold maximum
-
SIGMOID_THRESHOLD_MAX
¶ sigmoid threshold minimum
-
namespace
hppl
¶
-
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)¶
-
__m256
Defines
-
HL_DEVICE_FUNCTIONS_CUH_
¶
Functions
-
__device__ __forceinline__ void simpleReduce(real * smem, int tid, int threads)
sum reduction
- Return
- smem[0]: the sum of each elements in smem.
- Parameters
smem
: input data, better to use shared memory.tid
: thread index.threads
: the total thread number used to reduce, such as, blockDim.x.
-
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_
¶