From 0955592243b8ed122a14ab6c1cd8e02ed49ec6d9 Mon Sep 17 00:00:00 2001 From: David Riazati Date: Fri, 8 Mar 2019 15:26:25 -0800 Subject: [PATCH] Cast nn.Upsample.scale_factor to a float (#17732) Summary: Fixes #17106 Pull Request resolved: https://github.com/pytorch/pytorch/pull/17732 Differential Revision: D14388192 Pulled By: driazati fbshipit-source-id: d9c9e87a7c6db63c1de3ddebbb8dcf619f0dc34d --- torch/nn/modules/upsampling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch/nn/modules/upsampling.py b/torch/nn/modules/upsampling.py index da7b57d..38f98c0 100644 --- a/torch/nn/modules/upsampling.py +++ b/torch/nn/modules/upsampling.py @@ -126,7 +126,7 @@ class Upsample(Module): super(Upsample, self).__init__() self.name = type(self).__name__ self.size = size - self.scale_factor = scale_factor + self.scale_factor = float(scale_factor) if scale_factor else None self.mode = mode self.align_corners = align_corners -- 2.7.4