Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

initializer_variance_scaling

Initializer capable of adapting its scale to the shape of weights.


Description

With distribution="normal", samples are drawn from a truncated normal distribution centered on zero, with stddev = sqrt(scale / n) where n is:

  • number of input units in the weight tensor, if mode = "fan_in"

  • number of output units, if mode = "fan_out"

  • average of the numbers of input and output units, if mode = "fan_avg"

Usage

initializer_variance_scaling(
  scale = 1,
  mode = c("fan_in", "fan_out", "fan_avg"),
  distribution = c("normal", "uniform", "truncated_normal", "untruncated_normal"),
  seed = NULL
)

Arguments

scale

Scaling factor (positive float).

mode

One of "fan_in", "fan_out", "fan_avg".

distribution

One of "truncated_normal", "untruncated_normal" and "uniform". For backward compatibility, "normal" will be accepted and converted to "untruncated_normal".

seed

Integer used to seed the random generator.

Details

With distribution="uniform", samples are drawn from a uniform distribution within -limit, limit, with limit = sqrt(3 * scale / n).

See Also


keras

R Interface to 'Keras'

v2.4.0
MIT + file LICENSE
Authors
Daniel Falbel [ctb, cph, cre], JJ Allaire [aut, cph], François Chollet [aut, cph], RStudio [ctb, cph, fnd], Google [ctb, cph, fnd], Yuan Tang [ctb, cph] (<https://orcid.org/0000-0001-5243-233X>), Wouter Van Der Bijl [ctb, cph], Martin Studer [ctb, cph], Sigrid Keydana [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.