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

Function ggml_map_binary_impl_f32

ggml.c:5950–5974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5948// ggml_map_binary
5949
5950static 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
5976struct ggml_tensor * ggml_map_binary_f32(
5977 struct ggml_context * ctx,

Callers 2

ggml_map_binary_f32Function · 0.85

Calls 4

ggml_are_same_shapeFunction · 0.70
ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70
ggml_set_op_paramsFunction · 0.70

Tested by

no test coverage detected