MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / __init__

Method __init__

tensorflow/python/keras/layers/convolutional.py:2167–2188  ·  view source on GitHub ↗
(self, padding=(1, 1), data_format=None, **kwargs)

Source from the content-addressed store, hash-verified

2165 """
2166
2167 def __init__(self, padding=(1, 1), data_format=None, **kwargs):
2168 super(ZeroPadding2D, self).__init__(**kwargs)
2169 self.data_format = conv_utils.normalize_data_format(data_format)
2170 if isinstance(padding, int):
2171 self.padding = ((padding, padding), (padding, padding))
2172 elif hasattr(padding, '__len__'):
2173 if len(padding) != 2:
2174 raise ValueError('`padding` should have two elements. '
2175 'Found: ' + str(padding))
2176 height_padding = conv_utils.normalize_tuple(padding[0], 2,
2177 '1st entry of padding')
2178 width_padding = conv_utils.normalize_tuple(padding[1], 2,
2179 '2nd entry of padding')
2180 self.padding = (height_padding, width_padding)
2181 else:
2182 raise ValueError('`padding` should be either an int, '
2183 'a tuple of 2 ints '
2184 '(symmetric_height_pad, symmetric_width_pad), '
2185 'or a tuple of 2 tuples of 2 ints '
2186 '((top_pad, bottom_pad), (left_pad, right_pad)). '
2187 'Found: ' + str(padding))
2188 self.input_spec = InputSpec(ndim=4)
2189
2190 def compute_output_shape(self, input_shape):
2191 input_shape = tensor_shape.TensorShape(input_shape).as_list()

Callers

nothing calls this directly

Calls 2

InputSpecClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected