Buckets:
| namespace neuroflow { | |
| class SwiGLUFFN { | |
| public: | |
| size_t d_model_; | |
| size_t d_ff_; | |
| std::shared_ptr<Linear> w_gate_; | |
| std::shared_ptr<Linear> w_up_; | |
| std::shared_ptr<Linear> w_down_; | |
| struct Cache { | |
| Tensor input; | |
| Tensor gate_out; | |
| Tensor up_out; | |
| Tensor gate_activated; | |
| Tensor multiplied; | |
| }; | |
| Cache cache_; | |
| bool training_mode_ = false; | |
| SwiGLUFFN(size_t d_model, size_t d_ff = 0); | |
| Tensor forward(const Tensor& x); | |
| struct Gradients { | |
| Tensor w_gate_weight_grad; | |
| Tensor w_gate_bias_grad; | |
| Tensor w_up_weight_grad; | |
| Tensor w_up_bias_grad; | |
| Tensor w_down_weight_grad; | |
| Tensor w_down_bias_grad; | |
| Tensor input_grad; | |
| }; | |
| Gradients backward(const Tensor& output_grad); | |
| }; | |
| void launch_silu(float* data, size_t n, cudaStream_t stream); | |
| void launch_elementwise_mul(float* out, const float* a, const float* b, size_t n, cudaStream_t stream); | |
| } // namespace neuroflow | |
Xet Storage Details
- Size:
- 1.28 kB
- Xet hash:
- 1f5fc6e2473c2a5fd3e52d1d9766334865ab0956201bb9272e212cbbad5a4d7d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.