Learn R Programming

ggmlR (version 0.6.1)

ggml_layer_add: Element-wise Addition of Two Tensor Nodes

Description

Adds two (or more) tensor nodes element-wise. All tensors must have the same shape. This is the functional equivalent of a residual / skip connection.

Usage

ggml_layer_add(tensors, name = NULL)

Value

A new ggml_tensor_node representing the sum.

Arguments

tensors

A list of ggml_tensor_node objects (length >= 2).

name

Optional character name for the layer.

Examples

Run this code
# \donttest{
x    <- ggml_input(shape = 64L)
a    <- x |> ggml_layer_dense(64, activation = "relu")
b    <- x |> ggml_layer_dense(64)
out  <- ggml_layer_add(list(a, b))
# }

Run the code above in your browser using DataLab