| 4957 | // ggml_soft_max |
| 4958 | |
| 4959 | static struct ggml_tensor * ggml_soft_max_impl( |
| 4960 | struct ggml_context * ctx, |
| 4961 | struct ggml_tensor * a, |
| 4962 | bool inplace) { |
| 4963 | bool is_node = false; |
| 4964 | |
| 4965 | if (a->grad) { |
| 4966 | is_node = true; |
| 4967 | } |
| 4968 | |
| 4969 | struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a); |
| 4970 | |
| 4971 | result->op = GGML_OP_SOFT_MAX; |
| 4972 | result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; |
| 4973 | result->src[0] = a; |
| 4974 | |
| 4975 | return result; |
| 4976 | } |
| 4977 | |
| 4978 | struct ggml_tensor * ggml_soft_max( |
| 4979 | struct ggml_context * ctx, |
no test coverage detected