diff options
Diffstat (limited to 'torch/legacy/nn/DepthConcat.py')
-rw-r--r-- | torch/legacy/nn/DepthConcat.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/torch/legacy/nn/DepthConcat.py b/torch/legacy/nn/DepthConcat.py index b7abe9ad5e..19c31873ff 100644 --- a/torch/legacy/nn/DepthConcat.py +++ b/torch/legacy/nn/DepthConcat.py @@ -14,18 +14,19 @@ import math import torch from .Concat import Concat + class DepthConcat(Concat): def windowNarrow(self, output, currentOutput, offset): outputWindow = output.narrow(self.dimension, offset, currentOutput.size(self.dimension)) for dim in range(len(self.outputSize)): - currentSize = currentOutput.size(dim) - if dim != self.dimension and self.outputSize[dim] != currentSize: - # 5x5 vs 3x3 -> start = [(5-3)/2] + 1 = 2 (1 pad each side) - # 9x9 vs 5x5 -> start = [(9-5)/2] + 1 = 3 (2 pad each side) - # 9x9 vs 4x4 -> start = [(9-4)/2] + 1 = 3.5 (2 pad, 3 pad) - start = int(math.floor(((self.outputSize[dim] - currentSize) / 2))) - outputWindow = outputWindow.narrow(dim, start, currentSize) + currentSize = currentOutput.size(dim) + if dim != self.dimension and self.outputSize[dim] != currentSize: + # 5x5 vs 3x3 -> start = [(5-3)/2] + 1 = 2 (1 pad each side) + # 9x9 vs 5x5 -> start = [(9-5)/2] + 1 = 3 (2 pad each side) + # 9x9 vs 4x4 -> start = [(9-4)/2] + 1 = 3.5 (2 pad, 3 pad) + start = int(math.floor(((self.outputSize[dim] - currentSize) / 2))) + outputWindow = outputWindow.narrow(dim, start, currentSize) return outputWindow def updateOutput(self, input): |