| 5992 | // ggml_map_custom1_f32 |
| 5993 | |
| 5994 | static struct ggml_tensor * ggml_map_custom1_impl_f32( |
| 5995 | struct ggml_context * ctx, |
| 5996 | struct ggml_tensor * a, |
| 5997 | const ggml_custom1_op_f32_t fun, |
| 5998 | bool inplace) { |
| 5999 | bool is_node = false; |
| 6000 | |
| 6001 | if (!inplace && a->grad) { |
| 6002 | is_node = true; |
| 6003 | } |
| 6004 | |
| 6005 | struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a); |
| 6006 | |
| 6007 | ggml_set_op_params(result, (const void *) &fun, sizeof(fun)); |
| 6008 | |
| 6009 | result->op = GGML_OP_MAP_CUSTOM1_F32; |
| 6010 | result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; |
| 6011 | result->src[0] = a; |
| 6012 | |
| 6013 | return result; |
| 6014 | } |
| 6015 | |
| 6016 | struct ggml_tensor * ggml_map_custom1_f32( |
| 6017 | struct ggml_context * ctx, |
no test coverage detected