提交 51831978 authored 作者: Guillaume Alain's avatar Guillaume Alain 提交者: Arnaud Bergeron

Renamed a variable because I gave it a ridiculously long name.

上级 b0e830ff
...@@ -370,7 +370,7 @@ def mult_and_reduce(input_fft_v, filters_fft_v, input_shape=None, ...@@ -370,7 +370,7 @@ def mult_and_reduce(input_fft_v, filters_fft_v, input_shape=None,
def conv2d_fft(input, filters, image_shape=None, filter_shape=None, def conv2d_fft(input, filters, image_shape=None, filter_shape=None,
border_mode='valid', want_padding_on_last_input_dimension=False): border_mode='valid', pad_last_dim=False):
""" """
expects bc01 input expects bc01 input
performs a valid/full convolution performs a valid/full convolution
...@@ -380,10 +380,10 @@ def conv2d_fft(input, filters, image_shape=None, filter_shape=None, ...@@ -380,10 +380,10 @@ def conv2d_fft(input, filters, image_shape=None, filter_shape=None,
border_mode: 'valid' of 'full' border_mode: 'valid' of 'full'
want_padding_on_last_input_dimension: This code does not support pad_last_dim: This code does not support
images for which the last dimension (the "width") is odd. To support images for which the last dimension (the "width") is odd. To support
this, you can either pad your images on your own, or call this function this, you can either pad your images on your own, or call this function
with the `want_padding_on_last_input_dimension` flag set to `True`. with the `pad_last_dim` flag set to `True`.
This introduces an extra copying step and consumes memory. This introduces an extra copying step and consumes memory.
The return value will still be of the appropriate shape because The return value will still be of the appropriate shape because
the padding is trimmed right before the output is returned. the padding is trimmed right before the output is returned.
...@@ -404,7 +404,7 @@ def conv2d_fft(input, filters, image_shape=None, filter_shape=None, ...@@ -404,7 +404,7 @@ def conv2d_fft(input, filters, image_shape=None, filter_shape=None,
# pad filters/image to output shape # pad filters/image to output shape
if border_mode == 'valid': if border_mode == 'valid':
o0 = i0 o0 = i0
if want_padding_on_last_input_dimension: if pad_last_dim:
o1 = i1 + 1 o1 = i1 + 1
input_padded = T.zeros((b, ic, o0, o1), dtype='float32') input_padded = T.zeros((b, ic, o0, o1), dtype='float32')
input_padded = T.set_subtensor(input_padded[:, :, :i0, :i1], input_padded = T.set_subtensor(input_padded[:, :, :i0, :i1],
...@@ -459,7 +459,7 @@ def conv2d_fft(input, filters, image_shape=None, filter_shape=None, ...@@ -459,7 +459,7 @@ def conv2d_fft(input, filters, image_shape=None, filter_shape=None,
# slice because the convolution was circular, we need it to be valid # slice because the convolution was circular, we need it to be valid
if border_mode == 'valid': if border_mode == 'valid':
if want_padding_on_last_input_dimension: if pad_last_dim:
output = output_circ[:, :, f0 - 1:, f1 - 1:(o1-1)] output = output_circ[:, :, f0 - 1:, f1 - 1:(o1-1)]
else: else:
output = output_circ[:, :, f0 - 1:, f1 - 1:o1] output = output_circ[:, :, f0 - 1:, f1 - 1:o1]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论