Skip to contents

Strided-conv encoder with ReLU after every layer; transposed-conv decoder with ReLU after every layer but the last. Transposed conv gives (n-1)s + k per axis, so a decoder that does not land back on the input size is an error rather than a silent crop.

Usage

morie_geron_convolutional_autoencoder(
  x,
  encoder_weights,
  decoder_weights,
  stride = 2,
  output_activation = "identity"
)

Arguments

x

Image (H, W).

encoder_weights, decoder_weights

Lists of kernels.

stride

Shared stride.

output_activation

"identity", "tanh", "sigmoid".

Value

List with x_hat, code, code_shape, loss, mse_per_pixel, compression_ratio.

Examples

morie_geron_convolutional_autoencoder(x = 5L, encoder_weights = c(1, 2, 3, 4, 5, 6, 7, 8),
  decoder_weights = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $x_hat
#>            [,1]
#> [1,] 8128512000
#> 
#> $code
#>        [,1]
#> [1,] 201600
#> 
#> $code_shape
#> [1] 1 1
#> 
#> $loss
#> [1] 6.607271e+19
#> 
#> $mse_per_pixel
#> [1] 6.607271e+19
#> 
#> $compression_ratio
#> [1] 1
#> 
#> $estimate
#> [1] 6.607271e+19
#> 
#> $n
#> [1] 1
#> 
#> $method
#> [1] "Convolutional autoencoder forward pass"
#>