View source: R/nn_functional.R
| ggml_conv_2d_layer | R Documentation |
Builds a layer object to be applied with ggml_apply,
which is how a single set of convolution weights is shared between several
inputs. This is the convolution counterpart of ggml_dense.
ggml_conv_2d_layer(
filters,
kernel_size,
activation = NULL,
strides = c(1L, 1L),
padding = "valid",
name = NULL,
trainable = TRUE
)
filters |
Number of output filters. |
kernel_size |
Integer or length-2 integer vector. |
activation |
Activation function name or NULL. |
strides |
Integer or length-2 integer vector (default 1). |
padding |
|
name |
Optional character name. |
trainable |
Logical. |
For the ordinary pipe-style form that appends a conv layer to a graph
(x |> ggml_layer_conv_2d(...)), see ggml_layer_conv_2d.
A ggml_layer object.
ggml_apply, ggml_dense
# One convolution shared between two inputs.
shared <- ggml_conv_2d_layer(filters = 4L, kernel_size = 3L, activation = "relu")
x1 <- ggml_input(shape = c(8L, 8L, 1L))
x2 <- ggml_input(shape = c(8L, 8L, 1L))
o1 <- ggml_apply(x1, shared)
o2 <- ggml_apply(x2, shared)
stopifnot(identical(o1$layer_id, o2$layer_id)) # same weights
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.