InstanceNormalization¶
Inheritance Diagram

-
class
ashpy.layers.instance_normalization.InstanceNormalization(eps=1e-06, beta_initializer='zeros', gamma_initializer='ones')[source]¶ Bases:
tensorflow.python.keras.engine.base_layer.LayerInstance Normalization Layer (used by Pix2Pix 1 and Pix2PixHD 2 ).
Basically it’s a normalization done at instance level. The implementation follows the basic implementation of the Batch Normalization Layer.
Direct Usage:
x = tf.ones((1, 10, 10, 64)) # instantiate attention layer as model. normalization = InstanceNormalization() # evaluate passing x. output = normalization(x) # the output shape is. # the same as the input shape. print(output.shape)
Inside a Model:
def MyModel(): inputs = tf.keras.layers.Input(shape=[None, None, 64]) normalization = InstanceNormalization() return tf.keras.Model(inputs=inputs, outputs=normalization(inputs)) x = tf.ones((1, 10, 10, 64)) model = MyModel() output = model(x) print(output.shape)
(1, 10, 10, 64)
- 1
Image-to-Image Translation with Conditional Adversarial Networks https://arxiv.org/abs/1611.07004
- 2
High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs https://arxiv.org/abs/1711.11585
Methods
__init__([eps, beta_initializer, …])Initialize the layer.
build(input_shape)Assemble the layer.
call(inputs[, training])Perform the computation.
Attributes
activity_regularizerOptional regularizer function for the output of this layer.
dtypedynamicinbound_nodesDeprecated, do NOT use! Only for compatibility with external Keras.
inputRetrieves the input tensor(s) of a layer.
input_maskRetrieves the input mask tensor(s) of a layer.
input_shapeRetrieves the input shape(s) of a layer.
input_speclossesLosses which are associated with this Layer.
metricsnameReturns the name of this module as passed or determined in the ctor.
name_scopeReturns a tf.name_scope instance for this class.
non_trainable_variablesnon_trainable_weightsoutbound_nodesDeprecated, do NOT use! Only for compatibility with external Keras.
outputRetrieves the output tensor(s) of a layer.
output_maskRetrieves the output mask tensor(s) of a layer.
output_shapeRetrieves the output shape(s) of a layer.
submodulesSequence of all sub-modules.
trainabletrainable_variablesSequence of variables owned by this module and it’s submodules.
trainable_weightsupdatesvariablesReturns the list of all layer variables/weights.
weightsReturns the list of all layer variables/weights.
-
__init__(eps=1e-06, beta_initializer='zeros', gamma_initializer='ones')[source]¶ Initialize the layer.