1111# '
1212# ' @param stddev float, standard deviation of the noise distribution.
1313# '
14+ # ' @param seed Integer, optional random seed to enable deterministic behavior.
15+ # '
16+ # ' @param ... standard layer arguments.
17+ # '
1418# ' @section Input shape: Arbitrary. Use the keyword argument `input_shape` (list
1519# ' of integers, does not include the samples axis) when using this layer as
1620# ' the first layer in a model.
2024# ' @family noise layers
2125# '
2226# ' @export
23- layer_gaussian_noise <- function (object , stddev , input_shape = NULL ,
24- batch_input_shape = NULL , batch_size = NULL , dtype = NULL ,
25- name = NULL , trainable = NULL , weights = NULL ) {
26- create_layer(keras $ layers $ GaussianNoise , object , list (
27- stddev = stddev ,
28- input_shape = normalize_shape(input_shape ),
29- batch_input_shape = normalize_shape(batch_input_shape ),
30- batch_size = as_nullable_integer(batch_size ),
31- dtype = dtype ,
32- name = name ,
33- trainable = trainable ,
34- weights = weights
35- ))
27+ layer_gaussian_noise <-
28+ function (object , stddev , seed = NULL , ... )
29+ {
30+ args <- capture_args(match.call(),
31+ modifiers = c(standard_layer_arg_modifiers ,
32+ seed = as_nullable_integer ),
33+ ignore = " object" )
34+ create_layer(keras $ layers $ GaussianNoise , object , args )
3635}
3736
3837# ' Apply multiplicative 1-centered Gaussian noise.
@@ -44,6 +43,10 @@ layer_gaussian_noise <- function(object, stddev, input_shape = NULL,
4443# ' @param rate float, drop probability (as with `Dropout`). The multiplicative
4544# ' noise will have standard deviation `sqrt(rate / (1 - rate))`.
4645# '
46+ # ' @param seed Integer, optional random seed to enable deterministic behavior.
47+ # '
48+ # ' @param ... standard layer arguments.
49+ # '
4750# ' @section Input shape: Arbitrary. Use the keyword argument `input_shape` (list
4851# ' of integers, does not include the samples axis) when using this layer as
4952# ' the first layer in a model.
@@ -53,25 +56,24 @@ layer_gaussian_noise <- function(object, stddev, input_shape = NULL,
5356# ' @section References:
5457# ' - [Dropout: A Simple Way to Prevent Neural Networks from Overfitting Srivastava, Hinton, et al. 2014](https://www.cs.toronto.edu/~rsalakhu/papers/srivastava14a.pdf)
5558# '
59+ # ' @seealso
60+ # ' + <https://www.tensorflow.org/api_docs/python/tf/keras/layers/GaussianDropout>
61+ # '
5662# ' @family noise layers
5763# '
5864# ' @export
59- layer_gaussian_dropout <- function (object , rate , input_shape = NULL ,
60- batch_input_shape = NULL , batch_size = NULL , dtype = NULL ,
61- name = NULL , trainable = NULL , weights = NULL ) {
62- create_layer(keras $ layers $ GaussianDropout , object , list (
63- rate = rate ,
64- input_shape = normalize_shape(input_shape ),
65- batch_input_shape = normalize_shape(batch_input_shape ),
66- batch_size = as_nullable_integer(batch_size ),
67- dtype = dtype ,
68- name = name ,
69- trainable = trainable ,
70- weights = weights
71- ))
65+ layer_gaussian_dropout <-
66+ function (object , rate , seed = NULL , ... )
67+ {
68+ args <- capture_args(match.call(),
69+ modifiers = c(standard_layer_arg_modifiers ,
70+ seed = as_nullable_integer ),
71+ ignore = " object" )
72+ create_layer(keras $ layers $ GaussianDropout , object , args )
7273}
7374
7475
76+
7577# ' Applies Alpha Dropout to the input.
7678# '
7779# ' Alpha Dropout is a dropout that keeps mean and variance of inputs to their
0 commit comments