MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ggml_map_custom1_impl

Function ggml_map_custom1_impl

ggml.c:6125–6154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6123};
6124
6125static struct ggml_tensor * ggml_map_custom1_impl(
6126 struct ggml_context * ctx,
6127 struct ggml_tensor * a,
6128 const ggml_custom1_op_t fun,
6129 int n_tasks,
6130 void * userdata,
6131 bool inplace) {
6132 GGML_ASSERT(n_tasks == GGML_N_TASKS_MAX || n_tasks > 0);
6133
6134 bool is_node = false;
6135
6136 if (!inplace && a->grad) {
6137 is_node = true;
6138 }
6139
6140 struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
6141
6142 struct ggml_map_custom1_op_params params = {
6143 /*.fun =*/ fun,
6144 /*.n_tasks =*/ n_tasks,
6145 /*.userdata =*/ userdata
6146 };
6147 ggml_set_op_params(result, (const void *) &params, sizeof(params));
6148
6149 result->op = GGML_OP_MAP_CUSTOM1;
6150 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
6151 result->src[0] = a;
6152
6153 return result;
6154}
6155
6156struct ggml_tensor * ggml_map_custom1(
6157 struct ggml_context * ctx,

Callers 2

ggml_map_custom1Function · 0.70
ggml_map_custom1_inplaceFunction · 0.70

Calls 3

ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70
ggml_set_op_paramsFunction · 0.70

Tested by

no test coverage detected