Creates an instance normalization layer as described in the paper

Value

an instance normalization layer

Details

https://arxiv.org/abs/1701.02096

with the implementation ported from the following python implementation

https://github.com/keras-team/keras-contrib/blob/master/keras_contrib/layers/normalization/instancenormalization.py

Arguments

axis

Integer specifying which axis should be normalized, typically the feature axis. For example, after a Conv2D layer with channels_first, set axis = 2. Setting axis=-1L will normalize all values in each instance of the batch. Axis 1 is the batch dimension for tensorflow backend so we throw an error if axis = 1.

epsilon

Small float added to the variance to avoid dividing by 0.

center

If TRUE, add beta offset to normalized tensor.

scale

If TRUE, multiply by gamma.

betaInitializer

Intializer for the beta weight.

gammaInitializer

Intializer for the gamma weight.

betaRegularizer

Regularizer for the beta weight.

gammaRegularizer

Regularizer for the gamma weight.

betaConstraint

Optional constraint for the beta weight.

gammaConstraint

Optional constraint for the gamma weight.

Details

$initialize instantiates a new class.

$call main body.

$compute_output_shape computes the output shape.

Author

Tustison NJ

Examples

InstanceNormalizationLayer$new()
#> <InstanceNormalizationLayer> #> Inherits from: <KerasLayer> #> Public: #> .set_wrapper: function (wrapper) #> add_loss: function (losses, inputs = NULL) #> add_weight: function (name, shape, dtype = NULL, initializer = NULL, regularizer = NULL, #> axis: NULL #> betaConstraint: NULL #> betaInitializer: zeros #> betaRegularizer: NULL #> build: function (input_shape) #> call: function (inputs, mask = NULL) #> center: TRUE #> clone: function (deep = FALSE) #> compute_output_shape: function (input_shape) #> epsilon: 0.001 #> gammaConstraint: NULL #> gammaInitializer: ones #> gammaRegularizer: NULL #> initialize: function (axis = NULL, epsilon = 0.001, center = TRUE, scale = TRUE, #> input: active binding #> output: active binding #> python_layer: function () #> scale: TRUE #> Private: #> wrapper: NULL
InstanceNormalizationLayer$new(axis = 2L)
#> <InstanceNormalizationLayer> #> Inherits from: <KerasLayer> #> Public: #> .set_wrapper: function (wrapper) #> add_loss: function (losses, inputs = NULL) #> add_weight: function (name, shape, dtype = NULL, initializer = NULL, regularizer = NULL, #> axis: 2 #> betaConstraint: NULL #> betaInitializer: zeros #> betaRegularizer: NULL #> build: function (input_shape) #> call: function (inputs, mask = NULL) #> center: TRUE #> clone: function (deep = FALSE) #> compute_output_shape: function (input_shape) #> epsilon: 0.001 #> gammaConstraint: NULL #> gammaInitializer: ones #> gammaRegularizer: NULL #> initialize: function (axis = NULL, epsilon = 0.001, center = TRUE, scale = TRUE, #> input: active binding #> output: active binding #> python_layer: function () #> scale: TRUE #> Private: #> wrapper: NULL
testthat::expect_error(InstanceNormalizationLayer$new(axis = 1L))