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

Function ggml_set_impl

ggml.c:4261–4290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4259// ggml_set
4260
4261static struct ggml_tensor * ggml_set_impl(
4262 struct ggml_context * ctx,
4263 struct ggml_tensor * a,
4264 struct ggml_tensor * b,
4265 size_t nb1,
4266 size_t nb2,
4267 size_t nb3,
4268 size_t offset,
4269 bool inplace) {
4270 GGML_ASSERT(ggml_nelements(a) >= ggml_nelements(b));
4271
4272 bool is_node = false;
4273
4274 if (a->grad || b->grad) {
4275 is_node = true;
4276 }
4277
4278 // make a view of the destination
4279 struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
4280
4281 int32_t params[] = { nb1, nb2, nb3, offset, inplace ? 1 : 0 };
4282 ggml_set_op_params(result, params, sizeof(params));
4283
4284 result->op = GGML_OP_SET;
4285 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
4286 result->src[0] = a;
4287 result->src[1] = b;
4288
4289 return result;
4290}
4291
4292struct ggml_tensor * ggml_set(
4293 struct ggml_context * ctx,

Callers 6

ggml_setFunction · 0.70
ggml_set_inplaceFunction · 0.70
ggml_set_1dFunction · 0.70
ggml_set_1d_inplaceFunction · 0.70
ggml_set_2dFunction · 0.70
ggml_set_2d_inplaceFunction · 0.70

Calls 4

ggml_nelementsFunction · 0.70
ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70
ggml_set_op_paramsFunction · 0.70

Tested by

no test coverage detected