API - Initializers¶
To make TensorLayer simple, TensorLayer only warps some basic initializers. For more advanced initializer,
e.g. tf.initializers.he_normal
, please refer to TensorFlow provided initializers
here.
Initializer base class: all initializers inherit from this class. |
|
Initializer that generates tensors initialized to 0. |
|
Initializer that generates tensors initialized to 1. |
|
|
Initializer that generates tensors initialized to a constant value. |
|
Initializer that generates tensors with a uniform distribution. |
|
Initializer that generates tensors with a normal distribution. |
|
Initializer that generates a truncated normal distribution. |
Returns the initializer that can be passed to DeConv2dLayer for initializing the weights in correspondence to channel-wise bilinear up-sampling. |
Initializer¶
Zeros¶
Ones¶
Constant¶
RandomUniform¶
-
class
tensorlayer.initializers.
RandomUniform
(minval=-0.05, maxval=0.05, seed=None)[source]¶ Initializer that generates tensors with a uniform distribution.
- Parameters
minval (A python scalar or a scalar tensor.) – Lower bound of the range of random values to generate.
maxval (A python scalar or a scalar tensor.) – Upper bound of the range of random values to generate.
seed (A Python integer.) – Used to seed the random generator.
RandomNormal¶
-
class
tensorlayer.initializers.
RandomNormal
(mean=0.0, stddev=0.05, seed=None)[source]¶ Initializer that generates tensors with a normal distribution.
- Parameters
mean (A python scalar or a scalar tensor.) – Mean of the random values to generate.
stddev (A python scalar or a scalar tensor.) – Standard deviation of the random values to generate.
seed (A Python integer.) – Used to seed the random generator.
TruncatedNormal¶
-
class
tensorlayer.initializers.
TruncatedNormal
(mean=0.0, stddev=0.05, seed=None)[source]¶ Initializer that generates a truncated normal distribution.
These values are similar to values from a RandomNormal except that values more than two standard deviations from the mean are discarded and re-drawn. This is the recommended initializer for neural network weights and filters.
- Parameters
mean (A python scalar or a scalar tensor.) – Mean of the random values to generate.
stddev (A python scalar or a scalar tensor.) – Standard deviation of the andom values to generate.
seed (A Python integer.) – Used to seed the random generator.
deconv2d_bilinear_upsampling_initializer¶
-
tensorlayer.initializers.
deconv2d_bilinear_upsampling_initializer
(shape)[source]¶ Returns the initializer that can be passed to DeConv2dLayer for initializing the weights in correspondence to channel-wise bilinear up-sampling. Used in segmentation approaches such as [FCN](https://arxiv.org/abs/1605.06211)
- Parameters
shape (tuple of int) – The shape of the filters, [height, width, output_channels, in_channels]. It must match the shape passed to DeConv2dLayer.
- Returns
A constant initializer with weights set to correspond to per channel bilinear upsampling when passed as W_int in DeConv2dLayer
- Return type
tf.constant_initializer