Learn R Programming

ggmlR (version 0.6.1)

ggml_mul_mat: Matrix Multiplication (Graph)

Description

Creates a graph node for matrix multiplication. CRITICAL for LLM operations. For matrices A (m x n) and B (n x p), computes C = A * B (m x p).

Usage

ggml_mul_mat(ctx, a, b)

Value

Tensor representing the matrix multiplication

Arguments

ctx

GGML context

a

First matrix tensor

b

Second matrix tensor

Examples

Run this code
# \donttest{
ctx <- ggml_init(1024 * 1024)
A <- ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 4, 3)
B <- ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 4, 2)
ggml_set_f32(A, 1:12)
ggml_set_f32(B, 1:8)
C <- ggml_mul_mat(ctx, A, B)
graph <- ggml_build_forward_expand(ctx, C)
ggml_graph_compute(ctx, graph)
ggml_get_f32(C)
ggml_free(ctx)
# }

Run the code above in your browser using DataLab