Encoder model

To specify the encoder model architecture, we will use the following code:

# Encoderinput_layer <-          layer_input(shape = c(28,28,1)) encoder <-  input_layer %>%          layer_conv_2d(filters = 8,                        kernel_size = c(3,3),                        activation = 'relu',                        padding = 'same') %>%            layer_max_pooling_2d(pool_size = c(2,2),                              padding = 'same') %>%          layer_conv_2d(filters = 4,                        kernel_size = c(3,3),                        activation = 'relu',                        padding = 'same') %>%           layer_max_pooling_2d(pool_size = c(2,2),                               padding = 'same')  
summary(encoder)OutputTensor("max_pooling2d_10/MaxPool:0", shape=(?, 7, 7, 4), dtype=float32)

Here, for the input to the encoder, we specify the input layer so that it's 28 x 28 x 1 in size. Two convolutional layers, one with 8 filters and another with 4 filters, ...

Get Advanced Deep Learning with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.