              raise ValueError('Inputs should have rank ' +
                               str(4) +
                               '; Received input shape:', str(input_shape))
  
          if self.data_format == 'channels_first':
              batch_size, channels, height, width = input_shape
              if batch_size is None:
                  batch_size = -1
              r_height, r_width = self.size
              o_height, o_width = height * r_height, width * r_width
              o_channels = channels // (r_height * r_width)
  
              out = K.reshape(inputs, (batch_size, r_height, r_width, o_channels, height, width))
              out = K.permute_dimensions(out, (0, 3, 4, 1, 5, 2))
              out = K.reshape(out, (batch_size, o_channels, o_height, o_width))
          elif self.data_format == 'channels_last':
 
</s> remove         if len(input_shape) != 4:
            raise ValueError('Inputs should have rank ' +
                             str(4) +
                             '; Received input shape:', str(input_shape))

        if self.data_format == 'channels_first':
            height = None
            width = None
            if input_shape[2] is not None:
                height = input_shape[2] * self.size[0]
            if input_shape[3] is not None:
                width = input_shape[3] * self.size[1]
            channels = input_shape[1] // self.size[0] // self.size[1]

            if channels * self.size[0] * self.size[1] != input_shape[1]:
                raise ValueError('channels of input and size are incompatible')

            retval = (input_shape[0],
                      channels,
                      height,
                      width)
        elif self.data_format == 'channels_last':
            height = None
            width = None
            if input_shape[1] is not None:
                height = input_shape[1] * self.size[0]
            if input_shape[2] is not None:
                width = input_shape[2] * self.size[1]
            channels = input_shape[3] // self.size[0] // self.size[1]

            if channels * self.size[0] * self.size[1] != input_shape[3]:
                raise ValueError('channels of input and size are incompatible')
 </s> add         if self.data_format == 'channels_last':
            pooled = K.min(inputs, axis=[1, 2])
        else:
            pooled = K.min(inputs, axis=[2, 3])
        return pooled </s> remove     @classmethod
    def _depth_to_space(cls, ipt, scale, data_format=None):
        """ Uses phase shift algorithm to convert channels/depth for spatial resolution """
        if data_format is None:
            data_format = K.image_data_format()
        data_format = data_format.lower()
        ipt = cls._preprocess_conv2d_input(ipt, data_format)
        out = tf.nn.depth_to_space(ipt, scale)
        out = cls._postprocess_conv2d_output(out, data_format)
 </s> add             out = K.reshape(inputs, (batch_size, height, width, r_height, r_width, o_channels))
            out = K.permute_dimensions(out, (0, 1, 3, 2, 4, 5))
            out = K.reshape(out, (batch_size, o_height, o_width, o_channels)) </s> remove         if self.data_format == 'channels_last':
            pooled = K.min(inputs, axis=[1, 2])
        else:
            pooled = K.min(inputs, axis=[2, 3])
        return pooled
 </s> add         if self.data_format == "channels_first":
            batch, channels, rows, columns = input_shape
            return (batch,
                    channels // (self.scale_factor ** 2),
                    rows * self.scale_factor,
                    columns * self.scale_factor)
        batch, rows, columns, channels = input_shape
        return (batch,
                rows * self.scale_factor,
                columns * self.scale_factor,
                channels // (self.scale_factor ** 2)) </s> remove class L2_normalize(keras.layers.Layer):  # type:ignore[name-defined]  # pylint:disable=invalid-name
    """ Normalizes a tensor w.r.t. the L2 norm alongside the specified axis.
 </s> add         if data_format == "channels_first":
            inputs = tf.transpose(inputs, (0, 3, 1, 2))
    def call(self, inputs: tf.Tensor, *args, **kwargs) -> tf.Tensor:
        """ Override to call the layer.
              raise ValueError('Inputs should have rank ' +
                               str(4) +
                               '; Received input shape:', str(input_shape))
  
    def call(self, inputs: tf.Tensor, *args, **kwargs) -> tf.Tensor:
        """ Override to call the layer.
    def call(self, inputs: tf.Tensor, *args, **kwargs) -> tf.Tensor:
        """ Override to call the layer.
    def call(self, inputs: tf.Tensor, *args, **kwargs) -> tf.Tensor:
        """ Override to call the layer.
    def call(self, inputs: tf.Tensor, *args, **kwargs) -> tf.Tensor:
        """ Override to call the layer.
    def call(self, inputs: tf.Tensor, *args, **kwargs) -> tf.Tensor:
        """ Override to call the layer.
    def call(self, inputs: tf.Tensor, *args, **kwargs) -> tf.Tensor:
        """ Override to call the layer.
    def call(self, inputs: tf.Tensor, *args, **kwargs) -> tf.Tensor:
        """ Override to call the layer.
  
              out = K.reshape(inputs, (batch_size, r_height, r_width, o_channels, height, width))
              out = K.permute_dimensions(out, (0, 3, 4, 1, 5, 2))
              out = K.reshape(out, (batch_size, o_channels, o_height, o_width))
          elif self.data_format == 'channels_last':
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
 Training fixes:
  - Fix mixed precision layer storing and switching
  - typofix in _requirements_base.txt
  - lib.model.layers - cleanup, docs and tests fixes
  - lib.model.nn_blocks - typing fixes 
lib/model/layers.py