def _transit(network, n_filters): left = _normalized_convolution(X=network, n_filters=n_filters, kernel_shape=(3, 3), stride=(2, 2), pad=(1, 1)) left = _normalized_convolution(X=left, n_filters=n_filters, kernel_shape=(3, 3), stride=(2, 2), pad=(1, 1)) right = layers.pooling(X=network, mode='average', kernel_shape=(2, 2), stride=(2, 2), pad=(0, 0)) pad_width = (0, 0, 0, n_filters / 2, 0, 0, 0, 0) right = layers.pad(right, pad_width, 'constant') return right + right
def _transit(network, module_index): n_filters = {0 : 16, 1 : 32, 2 : 64}[module_index] if module_index == 0: network = _normalized_weighted_convolution(network, (3, 3), n_filters, (2, 2), (1, 1)) return network else: P = _normalized_weighted_convolution(network, (3, 3), n_filters, (2, 2), (1, 1)) P = _normalized_weighted_convolution(P, (3, 3), n_filters, (1, 1), (1, 1)) Q = layers.pooling(X=network, mode='average', kernel_shape=(2, 2), stride=(2, 2), pad=(0, 0)) Q = layers.pad(Q, (0, 0) + (0, n_filters / 2) + (0, 0) * 2, 'constant') return P + Q
def _transit(network, n_filters): network = layers.pooling(X=network, mode='average', kernel_shape=(2, 2), stride=(2, 2), pad=(0, 0)) network = layers.batch_normalization(network) pad_width = (0, 0, 0, n_filters / 2, 0, 0, 0, 0) network = layers.pad(network, pad_width, 'constant') return network