layer_independent_normal {tfprobability} | R Documentation |
An independent Normal Keras layer.
Description
An independent Normal Keras layer.
Usage
layer_independent_normal(
object,
event_shape,
convert_to_tensor_fn = tfp$distributions$Distribution$sample,
validate_args = FALSE,
...
)
Arguments
object |
What to compose the new
|
event_shape |
Scalar integer representing the size of single draw from this distribution. |
convert_to_tensor_fn |
A callable that takes a tfd$Distribution instance and returns a
tf$Tensor-like object. Default value: |
validate_args |
Logical, default FALSE. When TRUE distribution parameters are checked
for validity despite possibly degrading runtime performance. When FALSE invalid inputs may
silently render incorrect outputs. Default value: FALSE.
@param ... Additional arguments passed to |
... |
Additional arguments passed to |
Value
a Keras layer
See Also
Other distribution_layers:
layer_categorical_mixture_of_one_hot_categorical()
,
layer_distribution_lambda()
,
layer_independent_bernoulli()
,
layer_independent_logistic()
,
layer_independent_poisson()
,
layer_kl_divergence_add_loss()
,
layer_kl_divergence_regularizer()
,
layer_mixture_logistic()
,
layer_mixture_normal()
,
layer_mixture_same_family()
,
layer_multivariate_normal_tri_l()
,
layer_one_hot_categorical()
Examples
library(keras)
input_shape <- c(28, 28, 1)
encoded_shape <- 2
n <- 2
model <- keras_model_sequential(
list(
layer_input(shape = input_shape),
layer_flatten(),
layer_dense(units = n),
layer_dense(units = params_size_independent_normal(encoded_shape)),
layer_independent_normal(event_shape = encoded_shape)
)
)