Show / Hide Table of Contents

Class VarianceScaling

Initializer capable of adapting its scale to the shape of weights. 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"

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

Inheritance
System.Object
BaseInitializer
VarianceScaling
GlorotNormal
GlorotUniform
HeNormal
HeUniform
LecunNormal
LecunUniform
Inherited Members
BaseInitializer.Name
Namespace: SiaNet.Initializers
Assembly: SiaNet.dll
Syntax
public class VarianceScaling : BaseInitializer

Constructors

| Improve this Doc View Source

VarianceScaling(Single, String, String, Nullable<Int32>)

Initializes a new instance of the VarianceScaling class.

Declaration
public VarianceScaling(float scale = 1F, string mode = "fan_in", string distribution = "normal", int? seed = default(int? ))
Parameters
Type Name Description
System.Single scale

Scaling factor (positive float).

System.String mode

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

System.String distribution

Random distribution to use. One of "normal", "uniform".

System.Nullable<System.Int32> seed

Used to seed the random generator.

Exceptions
Type Condition
System.ArgumentException

Scale must be positive value

Properties

| Improve this Doc View Source

Distribution

Random distribution to use. One of "normal", "uniform".

Declaration
public string Distribution { get; set; }
Property Value
Type Description
System.String

The distribution.

| Improve this Doc View Source

Mode

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

Declaration
public string Mode { get; set; }
Property Value
Type Description
System.String

The mode.

| Improve this Doc View Source

Scale

Scaling factor (positive float).

Declaration
public float Scale { get; set; }
Property Value
Type Description
System.Single

The scale.

| Improve this Doc View Source

Seed

Used to seed the random generator.

Declaration
public int? Seed { get; set; }
Property Value
Type Description
System.Nullable<System.Int32>

The seed.

Methods

| Improve this Doc View Source

Generate(Int64[])

Generates a tensor with specified shape.

Declaration
public override Tensor Generate(params long[] shape)
Parameters
Type Name Description
System.Int64[] shape

The shape of the tensor.

Returns
Type Description
Tensor
Overrides
BaseInitializer.Generate(Int64[])

See Also

BaseInitializer
  • Improve this Doc
  • View Source
Back to top Generated by DocFX