Learn R Programming

ggmlR (version 0.6.1)

ggml_can_repeat: Check If Tensor Can Be Repeated

Description

Check if tensor a can be repeated (broadcast) to match tensor b. Used for broadcasting operations.

Usage

ggml_can_repeat(a, b)

Value

Logical indicating if a can be repeated to match b

Arguments

a

Source tensor (smaller)

b

Target tensor (larger or same size)

See Also

Other tensor_layout: ggml_are_same_stride(), ggml_count_equal(), ggml_is_contiguous_0(), ggml_is_contiguous_1(), ggml_is_contiguous_2(), ggml_is_contiguous_channels(), ggml_is_contiguous_rows(), ggml_is_contiguously_allocated()

Examples

Run this code
# \donttest{
ctx <- ggml_init(1024 * 1024)
a <- ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 4)
b <- ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 4, 8)
ggml_can_repeat(a, b)  # TRUE - a can broadcast along dim 1
ggml_free(ctx)
# }

Run the code above in your browser using DataLab