super(DepthwiseConv2D, self).__init__(custom_getter=custom_getter,
name=name)
if (not isinstance(channel_multiplier, numbers.Integral) or
channel_multiplier < 1):
raise ValueError("channel_multiplier (=%d), must be integer >= 1" %
channel_multiplier)
self._channel_multiplier = channel_multiplier
self._kernel_shape = _fill_and_verify_parameter_shape(kernel_shape, 2,
"kernel")
// We want to support passing native strides akin to [1, m, n, 1]
if isinstance(stride, collections.Iterable) and len(stride) == 4:
if not stride[0] == stride[3] == 1:
raise base.IncompatibleShapeError(
"Invalid stride: First and last element must be 1.")
self._stride = tuple(stride)
else:
self._stride = _fill_and_one_pad_stride(stride, 2)
self._padding = _verify_padding(padding)
self._use_bias = use_bias
self.possible_keys = self.get_possible_initializer_keys(use_bias=use_bias)
self._initializers = util.check_initializers(
initializers, self.possible_keys)
self._partitioners = util.check_partitioners(
partitioners, self.possible_keys)
self._regularizers = util.check_regularizers(
regularizers, self.possible_keys)
self._input_shape = None // Determined in build() from the input.
self._input_channels = None // Determined in build() from the input.
self._output_channels = None // Ditto, determined from the input and kernel.
@classmethod