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

Function ggml_get_rows

ggml.c:4805–4827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4803// ggml_get_rows
4804
4805struct ggml_tensor * ggml_get_rows(
4806 struct ggml_context * ctx,
4807 struct ggml_tensor * a,
4808 struct ggml_tensor * b) {
4809 GGML_ASSERT(ggml_is_matrix(a) && ggml_is_vector(b) && b->type == GGML_TYPE_I32);
4810
4811 bool is_node = false;
4812
4813 if (a->grad || b->grad) {
4814 is_node = true;
4815 }
4816
4817 // TODO: implement non F32 return
4818 //struct ggml_tensor * result = ggml_new_tensor_2d(ctx, a->type, a->ne[0], b->ne[0]);
4819 struct ggml_tensor * result = ggml_new_tensor_2d(ctx, GGML_TYPE_F32, a->ne[0], b->ne[0]);
4820
4821 result->op = GGML_OP_GET_ROWS;
4822 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
4823 result->src[0] = a;
4824 result->src[1] = b;
4825
4826 return result;
4827}
4828
4829// ggml_get_rows_back
4830

Callers 10

llm_build_inp_embdFunction · 0.70
build_optMethod · 0.70
build_starcoderMethod · 0.70
mainFunction · 0.50
forwardFunction · 0.50
forward_batchFunction · 0.50
forward_loraFunction · 0.50
clip_image_build_graphFunction · 0.50
llama_build_train_graphsFunction · 0.50

Calls 4

ggml_is_matrixFunction · 0.70
ggml_is_vectorFunction · 0.70
ggml_new_tensor_2dFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by 1

mainFunction · 0.40