| 6226 | } |
| 6227 | |
| 6228 | static void ggml_sub_or_set( |
| 6229 | struct ggml_context * ctx, |
| 6230 | struct ggml_cgraph * cgraph, |
| 6231 | size_t isrc, |
| 6232 | struct ggml_tensor * tensor) { |
| 6233 | struct ggml_tensor * src = cgraph->visited_hash_set.keys[isrc]; |
| 6234 | GGML_ASSERT(src); |
| 6235 | if (cgraph->grads[isrc]) { |
| 6236 | cgraph->grads[isrc] = ggml_sub_impl(ctx, cgraph->grads[isrc], tensor, cgraph->grad_accs[isrc]); |
| 6237 | } else { |
| 6238 | cgraph->grads[isrc] = ggml_neg(ctx, tensor); |
| 6239 | } |
| 6240 | ggml_format_name(cgraph->grads[isrc], "grad for %s", src->name); |
| 6241 | ggml_build_forward_expand(cgraph, cgraph->grads[isrc]); |
| 6242 | } |
| 6243 | |
| 6244 | static void ggml_compute_backward( |
| 6245 | struct ggml_context * ctx, struct ggml_cgraph * cgraph, int i, const bool * grads_needed) { |
no test coverage detected