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

Function copy_tensor_by_name

common/train.cpp:464–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464void copy_tensor_by_name(struct ggml_tensor * dst, struct ggml_context * ctx, const char * name) {
465 if (dst == NULL) {
466 return;
467 }
468 struct ggml_tensor * t = ggml_get_tensor(ctx, name);
469 GGML_ASSERT(are_same_layout(dst, t));
470 memcpy(dst->data, t->data, ggml_nbytes(t));
471
472 if (strlen(ggml_get_name(dst)) == 0) {
473 ggml_set_name(dst, name);
474 }
475}
476
477// gguf constants
478static const char * LLM_KV_OPTIMIZER_TYPE = "optimizer.type";

Callers 3

load_opt_context_ggufFunction · 0.85
load_llama_model_ggufFunction · 0.85
load_llama_lora_ggufFunction · 0.85

Calls 5

are_same_layoutFunction · 0.85
ggml_get_tensorFunction · 0.50
ggml_nbytesFunction · 0.50
ggml_get_nameFunction · 0.50
ggml_set_nameFunction · 0.50

Tested by

no test coverage detected