Skip to contents

a_l = phi(W_l a_{l-1} + b_l), stacked morie_geron_linear_layer_forward() calls; the last layer uses output_activation.

Usage

morie_geron_mlp_forward(
  x,
  weights,
  biases,
  activation = "relu",
  output_activation = NULL
)

Arguments

x

Input vector or batch.

weights, biases

Lists of (out, in) matrices and biases.

activation

One of "relu", "tanh", "sigmoid", "identity".

output_activation

Optional override for the last layer.

Value

List with output, activations, layer_sizes, n_layers, n_parameters, dead_units.

Examples

morie_geron_mlp_forward(x = 5L, weights = c(1, 2, 3, 4, 5, 6, 7, 8),
  biases = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $output
#> [1] 311200
#> 
#> $activations
#> $activations[[1]]
#> [1] 5
#> 
#> $activations[[2]]
#> [1] 6
#> 
#> $activations[[3]]
#> [1] 14
#> 
#> $activations[[4]]
#> [1] 45
#> 
#> $activations[[5]]
#> [1] 184
#> 
#> $activations[[6]]
#> [1] 925
#> 
#> $activations[[7]]
#> [1] 5556
#> 
#> $activations[[8]]
#> [1] 38899
#> 
#> $activations[[9]]
#> [1] 311200
#> 
#> 
#> $layer_sizes
#> [1] 1 1 1 1 1 1 1 1 1
#> 
#> $n_layers
#> [1] 8
#> 
#> $n_parameters
#> [1] 16
#> 
#> $dead_units
#> [1] 0
#> 
#> $estimate
#> [1] 311200
#> 
#> $n
#> [1] 1
#>