class_docstr: Normalizes inputs along the spatial dimensions.
  
  See :class:`LayerNorm` for more details.
  
  Attributes:
    scale: If ``create_scale=True``, a trainable :tf:`Variable` holding the
      current scale.
    offset: If ``create_offset=True``, a trainable :tf:`Variable` holding the
      current offset.
docstr: Constructs an ``InstanceNorm`` module.
  
  This method creates a module which normalizes over the spatial dimensions.
  
  Args:
    create_scale: ``bool`` representing whether to create a trainable scale
      per channel applied after the normalization.
    create_offset: ``bool`` representing whether to create a trainable offset
      per channel applied after normalization and scaling.
    eps: Small epsilon to avoid division by zero variance. Defaults to
      ``1e-5``.
    scale_init: Optional initializer for the scale variable. Can only be set
      if ``create_scale=True``. By default scale is initialized to ``1``.
    offset_init: Optional initializer for the offset variable. Can only be set
      if ``create_offset=True``. By default offset is initialized to ``0``.
    data_format: The data format of the input. Can be either
      ``channels_first``, ``channels_last``, ``N...C`` or ``NC...``. By
      default it is ``channels_last``.
    name: Name of the module.
docstr_tok: ["Constructs","an","``","InstanceNorm","``","module",".","This","method","creates","a","module","which","normalizes","over","the","spatial","dimensions",".","Args",":","create_scale",":","``","bool","``","representing","whether","to","create","a","trainable","scale","per","channel","applied","after","the","normalization",".","create_offset",":","``","bool","``","representing","whether","to","create","a","trainable","offset","per","channel","applied","after","normalization","and","scaling",".","eps",":","Small","epsilon","to","avoid","division","by","zero","variance",".","Defaults","to","``","1e-5","``",".","scale_init",":","Optional","initializer","for","the","scale","variable",".","Can","only","be","set","if","``","create_scale=True","``",".","By","default","scale","is","initialized","to","``","1","``",".","offset_init",":","Optional","initializer","for","the","offset","variable",".","Can","only","be","set","if","``","create_offset=True","``",".","By","default","offset","is","initialized","to","``","0","``",".","data_format",":","The","data","format","of","the","input",".","Can","be","either","``","channels_first","``",",","``","channels_last","``",",","``","N","...","C","``","or","``","NC","...","``",".","By","default","it","is","``","channels_last","``",".","name",":","Name","of","the","module","."]
code: def __init__(
      self,
      create_scale: bool,
      create_offset: bool,
      eps: types.FloatLike = 1e-5,
      scale_init: Optional[initializers.Initializer] = None,
      offset_init: Optional[initializers.Initializer] = None,
      data_format: str = "channels_last",
      name: Optional[str] = None,
  ):
      """Constructs an ``InstanceNorm`` module.
  
      This method creates a module which normalizes over the spatial dimensions.
  
      Args:
        create_scale: ``bool`` representing whether to create a trainable scale
          per channel applied after the normalization.
        create_offset: ``bool`` representing whether to create a trainable offset
          per channel applied after normalization and scaling.
        eps: Small epsilon to avoid division by zero variance. Defaults to
          ``1e-5``.
        scale_init: Optional initializer for the scale variable. Can only be set
          if ``create_scale=True``. By default scale is initialized to ``1``.
        offset_init: Optional initializer for the offset variable. Can only be set
          if ``create_offset=True``. By default offset is initialized to ``0``.
        data_format: The data format of the input. Can be either
          ``channels_first``, ``channels_last``, ``N...C`` or ``NC...``. By
          default it is ``channels_last``.
        name: Name of the module.
      """
      if utils.get_channel_index(data_format) == 1:
          axis = slice(2, None)
      else:  # channel_index = -1
          axis = slice(1, -1)
      super().__init__(
          axis=axis,
          create_scale=create_scale,
          create_offset=create_offset,
          eps=eps,
          scale_init=scale_init,
          offset_init=offset_init,
          data_format=data_format,
          name=name,
      )
  
file_path: sonnet/sonnet/src/axis_norm.py
imports: import collections.abc
  from typing import Optional
  from sonnet.src import base
  from sonnet.src import initializers
  from sonnet.src import once
  from sonnet.src import types
  from sonnet.src import utils
  import tensorflow
label_desc: Use image node_id 1 to create a new InstanceNorm object from inherited base classes: LayerNorm with example: obj = InstanceNorm(create_scale, create_offset, eps, scale_init, offset_init, data_format, name)