This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fixed_padding(inputs, kernel_size, data_format): | |
""" | |
Pads the input along the spatial dimensions independently of input size. | |
:param inputs: A tensor of size [batch, channels, height_in, width_in] or [batch, height_in, width_in] | |
:param kernel_size: The kernel to be used in the conv2d or max_pool2d operation. Should be a positive integer. | |
:param data_format: The input format ('channels_last' or 'channels_first'). | |
:return A tensor with the same format as the input with the data either intact (if kernel_size == 1) or padded (if kernel_size > 1). | |
""" | |
pad_total = kernel_size - 1 | |
pad_beg = pad_total // 2 |
NewerOlder