| 3930 | // ggml_norm |
| 3931 | |
| 3932 | static struct ggml_tensor * ggml_norm_impl( |
| 3933 | struct ggml_context * ctx, |
| 3934 | struct ggml_tensor * a, |
| 3935 | float eps, |
| 3936 | bool inplace) { |
| 3937 | bool is_node = false; |
| 3938 | |
| 3939 | if (!inplace && (a->grad)) { |
| 3940 | GGML_ASSERT(false); // TODO: implement backward |
| 3941 | is_node = true; |
| 3942 | } |
| 3943 | |
| 3944 | struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a); |
| 3945 | |
| 3946 | ggml_set_op_params(result, &eps, sizeof(eps)); |
| 3947 | |
| 3948 | result->op = GGML_OP_NORM; |
| 3949 | result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; |
| 3950 | result->src[0] = a; |
| 3951 | |
| 3952 | return result; |
| 3953 | } |
| 3954 | |
| 3955 | struct ggml_tensor * ggml_norm( |
| 3956 | struct ggml_context * ctx, |
no test coverage detected