def _initialize(self, inputs):
    utils.assert_rank(inputs, self._num_spatial_dims + 2)
    self.input_channels = inputs.shape[self._channel_index]
    if self.input_channels is None:
      raise ValueError("The number of input channels must be known")
    self._dtype = inputs.dtype

    if self._output_shape is not None:
      if len(self._output_shape) != self._num_spatial_dims:
        raise ValueError(
            "The output_shape must be of length {} but instead was {}.".format(
                self._num_spatial_dims, len(self._output_shape)))
      if self._channel_index == 1:
        self._output_shape = [self._output_channels] + list(self._output_shape)
      else:
        self._output_shape = list(self._output_shape) + [self._output_channels]

    self.w = self._make_w()
    if self._with_bias:
      self.b = tf.Variable(
          self._b_init((self._output_channels,), self._dtype), name="b")