MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / gpt2_zero_grad

Function gpt2_zero_grad

experimental/kernels/gpt2_webgpu.cpp:455–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455void gpt2_zero_grad(GPT2 *model) {
456 if(model->grads_memory != NULL) { memset(model->grads_memory, 0, model->num_parameters * sizeof(float)); }
457 if(model->grads_acts_memory != NULL) { memset(model->grads_acts_memory, 0, model->num_activations * sizeof(float)); }
458}
459
460void gpt2_backward(Context& ctx, GPT2 *model) {
461 printf("Backward pass\n");

Callers 2

gpt2_backwardFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected