summaryrefslogtreecommitdiff
path: root/torch
diff options
context:
space:
mode:
authorKato Tetsuro <nistetsurooy@gmail.com>2018-02-17 11:06:08 +0900
committerSoumith Chintala <soumith@gmail.com>2018-02-16 21:06:08 -0500
commit5c93ca258bab7bd74a8ec94d64647e48c8ad8797 (patch)
treecee771b17060c5e725d72a6db7333b9af9c87c1b /torch
parent3ffd6ffa7df536bec9205b2ef490f5f103760af9 (diff)
downloadpytorch-5c93ca258bab7bd74a8ec94d64647e48c8ad8797.tar.gz
pytorch-5c93ca258bab7bd74a8ec94d64647e48c8ad8797.tar.bz2
pytorch-5c93ca258bab7bd74a8ec94d64647e48c8ad8797.zip
check attribute existence in SpatialFullConvolution (#5255)
Diffstat (limited to 'torch')
-rw-r--r--torch/legacy/nn/SpatialFullConvolution.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/torch/legacy/nn/SpatialFullConvolution.py b/torch/legacy/nn/SpatialFullConvolution.py
index cd0e9c41ee..63ba58dab4 100644
--- a/torch/legacy/nn/SpatialFullConvolution.py
+++ b/torch/legacy/nn/SpatialFullConvolution.py
@@ -88,14 +88,14 @@ class SpatialFullConvolution(Module):
tW = targetTensor.size(tDims - 1)
adjW = self._calculateAdj(tW, self.kW, self.padW, self.dW)
adjH = self._calculateAdj(tH, self.kH, self.padH, self.dH)
- if self.finput is None:
+ if not hasattr(self, 'finput') or self.finput is None:
self.finput = input[0].new()
- if self.fgradInput is None:
+ if not hasattr(self, 'fgradInput') or self.fgradInput is None:
self.fgradInput = input[0].new()
else:
- if self.finput is None:
+ if not hasattr(self, 'finput') or self.finput is None:
self.finput = input.new()
- if self.fgradInput is None:
+ if not hasattr(self, 'fgradInput') or self.fgradInput is None:
self.fgradInput = input.new()
inputTensor = self._makeContiguous(inputTensor)