ggerganov / ggml

Tensor library for machine learning
MIT License
11.25k stars 1.05k forks source link

test: fix OPT_STEP_ADAMW for test-backend-ops #974

Closed JohannesGaessler closed 1 month ago

JohannesGaessler commented 1 month ago

Fixup for https://github.com/ggerganov/ggml/pull/966 .

When I tested GGML_OP_OPT_STEP_ADAMW I had mistyped the filter for test-backend-ops so I didn't notice that the test is broken. The problem is that the gradients for tensors are no longer being allocated unless a backward graph is constructed. This can simply be fixed by explicitly creating a tensor the gradients. Also I'm changing the interface for ggml_opt_step_adamw to accept a gradient tensor since the long term goal for ggml_tensor.grad is to remove it.