Learn R Programming

ggmlR (version 0.6.1)

ggml_are_same_layout: Check if Two Tensors Have the Same Layout

Description

Compares two tensors to check if they have identical type, shape, and strides. Tensors with the same layout can be used interchangeably for memory operations.

Usage

ggml_are_same_layout(a, b)

Value

Logical indicating if tensors have identical layout

Arguments

a

External pointer to first tensor

b

External pointer to second tensor

See Also

Other tensor: ggml_get_op_params(), ggml_get_op_params_f32(), ggml_get_op_params_i32(), ggml_set_op_params(), ggml_set_op_params_f32(), ggml_set_op_params_i32()

Examples

Run this code
# \donttest{
ctx <- ggml_init(1024 * 1024)
a <- ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 4, 4)
b <- ggml_new_tensor_2d(ctx, GGML_TYPE_F32, 4, 4)
same <- ggml_are_same_layout(a, b)  # TRUE
ggml_free(ctx)
# }

Run the code above in your browser using DataLab