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

Function ggml_unary_impl

ggml.c:5874–5894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5872// gmml_unary
5873
5874static struct ggml_tensor * ggml_unary_impl(
5875 struct ggml_context * ctx,
5876 struct ggml_tensor * a,
5877 enum ggml_unary_op op,
5878 bool inplace) {
5879 bool is_node = false;
5880
5881 if (!inplace && (a->grad)) {
5882 is_node = true;
5883 }
5884
5885 struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
5886
5887 ggml_set_op_params_i32(result, 0, (int32_t) op);
5888
5889 result->op = GGML_OP_UNARY;
5890 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
5891 result->src[0] = a;
5892
5893 return result;
5894}
5895
5896struct ggml_tensor * ggml_unary(
5897 struct ggml_context * ctx,

Callers 2

ggml_unaryFunction · 0.70
ggml_unary_inplaceFunction · 0.70

Calls 3

ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70
ggml_set_op_params_i32Function · 0.70

Tested by

no test coverage detected