Wrapper for a convolutional layer. The dimensions of the convolution operation are
inferred from the shape of the input data. This shape must follow the pattern
(batch_shape, x, [y, [z, ]], channel)
where dimensions y
and z
are optional, and channel
will be either 1
for grayscale images or
generally 3
for colored ones.
conv(
filters,
kernel_size,
padding = "same",
max_pooling = NULL,
average_pooling = NULL,
upsampling = NULL,
activation = "linear"
)
Number of filters learned by the layer
Integer or list of integers indicating the size of the weight matrices to be convolved with the image
One of "valid" or "same" (case-insensitive). See
layer_conv_2d
for more details
NULL
or an integer indicating the reduction ratio for a max
pooling operation after the convolution
NULL
or an integer indicating the reduction ratio for
an average pooling operation after the convolution
NULL
or an integer indicating the augmentation ratio for an
upsampling operation after the convolution
Optional, string indicating activation function (linear by default)
A construct with class "ruta_network"
Other neural layers:
dense()
,
dropout()
,
input()
,
layer_keras()
,
output()
,
variational_block()
# Sample convolutional autoencoder
net <- input() +
conv(16, 3, max_pooling = 2, activation = "relu") +
conv(8, 3, max_pooling = 2, activation = "relu") +
conv(8, 3, upsampling = 2, activation = "relu") +
conv(16, 3, upsampling = 2, activation = "relu") +
conv(1, 3, activation = "sigmoid")