VarianceScaling

open class VarianceScaling(scale: Double, mode: Mode, distribution: Distribution, seed: Long) : Initializer

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

With distribution="truncated_normal" or "untruncated_normal", samples are drawn from a truncated/untruncated normal distribution with a mean of zero and a standard deviation (after truncation, if used) 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"

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

Constructors

VarianceScaling
Link copied to clipboard
fun VarianceScaling(scale: Double = 1.0, mode: Mode = Mode.FAN_IN, distribution: Distribution = Distribution.TRUNCATED_NORMAL, seed: Long = 12L)

Creates VarianceScaling initializer.

Functions

apply
Link copied to clipboard
fun apply(fanIn: Int, fanOut: Int, tf: Ops, input: Operand<Float>, name: String): InitializerOperation

Adds an Assign Op to the graph to initialize a tensorflow variable as specified by the initializer.

initialize
Link copied to clipboard
open override fun initialize(fanIn: Int, fanOut: Int, tf: Ops, shape: Operand<Int>, name: String): Operand<Float>

Returns a Tensor object initialized as specified by the initializer.

toString
Link copied to clipboard
open override fun toString(): String

Properties

distribution
Link copied to clipboard
val distribution: Distribution

Random distribution to use. One of "truncated_normal", "untruncated_normal" and "uniform".

mode
Link copied to clipboard
val mode: Mode

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

scale
Link copied to clipboard
val scale: Double = 1.0

Scaling factor (should be positive).

seed
Link copied to clipboard
val seed: Long = 12L

Used to create random seeds.

Inheritors

GlorotNormal
Link copied to clipboard
GlorotUniform
Link copied to clipboard
HeNormal
Link copied to clipboard
HeUniform
Link copied to clipboard
LeCunNormal
Link copied to clipboard
LeCunUniform
Link copied to clipboard