# \donttest{
if (ggml_vulkan_available() && ggml_vulkan_device_count() >= 2) {
K <- 32L; M <- 4L
W1 <- matrix(rnorm(K * K), K); W2 <- matrix(rnorm(K * K), K)
stage <- function(dev, Wt) list(
device = dev, in_shape = c(K, M),
build = function(ctx, input) {
w <- ggml_new_tensor_2d(ctx, GGML_TYPE_F32, K, K)
ggml_mul_mat(ctx, w, input) # (weights set inside build via attr, see vignette)
})
# See inst/examples/pp_pipeline.R for a complete runnable stage definition.
}
# }
Run the code above in your browser using DataLab