# VarianceScaling

public class VarianceScaling
Known Direct Subclasses

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

With ``` distribution=TRUNCATED_NORMAL or NORMAL ``` , samples are drawn from a truncated/untruncated normal distribution with a mean of zero and a standard deviation (after truncation, if used) ``` stddev = Math.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] ``` , where ``` limit = Math.sqrt(3 * scale / n); ``` .

Examples:

```      long seed = 1234l;
float scale = 0.1f;
VarianceScaling<TFloat32, TFloat32> initializer =
new org.tensorflow.framework.initializers.VarianceScaling<>(
tf, scale, Mode.FAN_IN, Distribution.UNIFORM, seed);
Operand<TFloat32> values =
initializer.call(tf.constant(Shape.of(2,2)), TFloat32.class);
```

• ``` VarianceScaling.Mode ```
• ``` VarianceScaling.Distribution ```

### Nested Classes

 enum VarianceScaling.Distribution The random distribution to use when initializing the values. enum VarianceScaling.Mode The mode to use for calculating the fan values.

### Constants

 double SCALE_DEFAULT

### Fields

 public static final VarianceScaling.Distribution DISTRIBUTION_DEFAULT public static final VarianceScaling.Mode MODE_DEFAULT

### Public Constructors

 (Ops tf, long seed) Creates a VarianceScaling Initializer (Ops tf, double scale, VarianceScaling.Mode mode, VarianceScaling.Distribution distribution, long seed) Creates a VarianceScaling Initializer

### Public Methods

 Operand ( Operand < TInt64 > dims, Class type)

## Constants

#### public static final double SCALE_DEFAULT

Constant Value: 1.0

## Public Constructors

#### public VarianceScaling (Ops tf, long seed)

Creates a VarianceScaling Initializer

##### Parameters
 tf the TensorFlow Ops sed to create random seeds.

#### public VarianceScaling (Ops tf, double scale, VarianceScaling.Mode mode, VarianceScaling.Distribution distribution, long seed)

Creates a VarianceScaling Initializer

##### Parameters
 tf the TensorFlow Ops Scaling factor (positive float). the mode for the variance Random distribution to use. Used to create random seeds.

## Public Methods

#### public Operand <T> call ( Operand < TInt64 > dims, Class<T> type)

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]