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

Function ggml_map_unary_impl_f32

ggml.c:5912–5932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5910// ggml_map_unary
5911
5912static struct ggml_tensor * ggml_map_unary_impl_f32(
5913 struct ggml_context * ctx,
5914 struct ggml_tensor * a,
5915 const ggml_unary_op_f32_t fun,
5916 bool inplace) {
5917 bool is_node = false;
5918
5919 if (!inplace && a->grad) {
5920 is_node = true;
5921 }
5922
5923 struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
5924
5925 ggml_set_op_params(result, (const void *) &fun, sizeof(fun));
5926
5927 result->op = GGML_OP_MAP_UNARY;
5928 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
5929 result->src[0] = a;
5930
5931 return result;
5932}
5933
5934struct ggml_tensor * ggml_map_unary_f32(
5935 struct ggml_context * ctx,

Callers 2

ggml_map_unary_f32Function · 0.85

Calls 3

ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70
ggml_set_op_paramsFunction · 0.70

Tested by

no test coverage detected