| ggml_count_equal | R Documentation |
Creates a graph node that counts equal elements between two tensors. Useful for accuracy computation.
ggml_count_equal(ctx, a, b)
ctx |
GGML context |
a |
First tensor |
b |
Second tensor (same shape as a) |
Tensor containing the count of equal elements
Other tensor_layout:
ggml_are_same_stride(),
ggml_can_repeat(),
ggml_is_contiguous_0(),
ggml_is_contiguous_1(),
ggml_is_contiguous_2(),
ggml_is_contiguous_channels(),
ggml_is_contiguous_rows(),
ggml_is_contiguously_allocated()
ctx <- ggml_init(16 * 1024 * 1024)
pred <- ggml_new_tensor_1d(ctx, GGML_TYPE_I32, 100)
labels <- ggml_new_tensor_1d(ctx, GGML_TYPE_I32, 100)
# ... set values ...
correct <- ggml_count_equal(ctx, pred, labels)
graph <- ggml_build_forward_expand(ctx, correct)
ggml_graph_compute(ctx, graph)
# correct now contains count of matching elements
ggml_free(ctx)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.