| 5948 | // ggml_map_binary |
| 5949 | |
| 5950 | static struct ggml_tensor * ggml_map_binary_impl_f32( |
| 5951 | struct ggml_context * ctx, |
| 5952 | struct ggml_tensor * a, |
| 5953 | struct ggml_tensor * b, |
| 5954 | const ggml_binary_op_f32_t fun, |
| 5955 | bool inplace) { |
| 5956 | GGML_ASSERT(ggml_are_same_shape(a, b)); |
| 5957 | |
| 5958 | bool is_node = false; |
| 5959 | |
| 5960 | if (!inplace && (a->grad || b->grad)) { |
| 5961 | is_node = true; |
| 5962 | } |
| 5963 | |
| 5964 | struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a); |
| 5965 | |
| 5966 | ggml_set_op_params(result, (const void *) &fun, sizeof(fun)); |
| 5967 | |
| 5968 | result->op = GGML_OP_MAP_BINARY; |
| 5969 | result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; |
| 5970 | result->src[0] = a; |
| 5971 | result->src[1] = b; |
| 5972 | |
| 5973 | return result; |
| 5974 | } |
| 5975 | |
| 5976 | struct ggml_tensor * ggml_map_binary_f32( |
| 5977 | struct ggml_context * ctx, |
no test coverage detected