std1.0.0-beta-7 SafeC docs

std :: ml::gpu_cudnn

Struct std::CudaHalfConv2D

#include <std/ml/gpu_cudnn.h> source

struct CudaHalfConv2D {
    struct CudaHalfBuf weight;
    struct CudaHalfBuf bias;
    unsigned long inChannels;
    unsigned long outChannels;
    unsigned long kH;
    unsigned long kW;
    unsigned long stride;
    unsigned long padding;
}

The same convolution on 16-bit NCHW tensors (gpu_cuda.h's CudaHalfBuf): cuDNN's half / bfloat16 convolutions (fp32 compute, tensor cores where cuDNN picks them), rounding once per output; the bias add and ReLU are one fused 16-bit kernel (cuda_half_bias). Weights are rounded from a Conv2D's fp32 ones on upload. x, y and the layer must share one dtype.

Fields

§struct CudaHalfBuf weightsource
§unsigned long inChannelssource
§unsigned long outChannelssource
§unsigned long kHsource
§unsigned long kWsource
§unsigned long stridesource
§unsigned long paddingsource

Methods

§void free()source · definition
§int forward( struct CudaHalfBuf x, struct CudaHalfBuf y, unsigned long batch, unsigned long height, unsigned long width, ) constsource · definition
§int forward_relu( struct CudaHalfBuf x, struct CudaHalfBuf y, unsigned long batch, unsigned long height, unsigned long width, ) constsource · definition
§static struct CudaHalfConv2D upload(const &Conv2D layer, int dtype)source · definition

CUDA_FP16 / CUDA_BF16