|
My Project
|
Fully connected layer with activation, using column-major matrices. More...
Public Member Functions | |
| CudaDenseLayer (int in, int out, ActivationType act) | |
| Construct a dense layer. More... | |
| int | in () const |
| Input dimension. More... | |
| int | out () const |
| Output dimension. More... | |
| size_t | params_size () const |
| Total parameter count (weights + bias) More... | |
| size_t | weights_size () const |
| Weights parameter count. More... | |
| size_t | bias_size () const |
| Bias parameter count. More... | |
| void | bind (CudaScalar *params, CudaScalar *grads) |
| Bind parameter and gradient buffers. More... | |
| CudaScalar | init_stddev () const |
| Recommended stddev for weight initialization. More... | |
| void | forward (CublasHandle &handle, const CudaScalar *input, int batch, CudaScalar *output) |
| Forward pass: Z = W*X + b, A = act(Z) More... | |
| void | backward (CublasHandle &handle, const CudaScalar *input, const CudaScalar *output, CudaScalar *next_grad, int batch, CudaScalar *prev_grad) |
| Backward pass: compute dW, db, and optionally dX. More... | |
| const CudaScalar * | params_ptr () const |
| Raw parameter pointer for this layer. More... | |
| const CudaScalar * | grads_ptr () const |
| Raw gradient pointer for this layer. More... | |
Fully connected layer with activation, using column-major matrices.
|
inline |
Construct a dense layer.
| in | Input dimension |
| out | Output dimension |
| act | Activation type |
|
inline |
Backward pass: compute dW, db, and optionally dX.
| handle | cuBLAS handle |
| input | Input activations |
| output | Output activations |
| next_grad | Gradient w.r.t. output (out x batch), updated in-place |
| batch | Batch size |
| prev_grad | Optional gradient w.r.t. input (in x batch) |

|
inline |
Bias parameter count.
|
inline |
Bind parameter and gradient buffers.
|
inline |
Forward pass: Z = W*X + b, A = act(Z)
| handle | cuBLAS handle |
| input | Input matrix (in x batch) |
| batch | Batch size |
| output | Output matrix (out x batch) |

|
inline |
Raw gradient pointer for this layer.
|
inline |
Input dimension.
|
inline |
Recommended stddev for weight initialization.

|
inline |
Output dimension.
|
inline |
Raw parameter pointer for this layer.
|
inline |
Total parameter count (weights + bias)
|
inline |
Weights parameter count.