From 3199aa7c3852ad2afc99bbba5b2005026c9b908f Mon Sep 17 00:00:00 2001 From: cclauss Date: Fri, 30 Nov 2018 06:07:32 +0100 Subject: [PATCH] =?UTF-8?q?cuda(async)=20=E2=80=94>=20cuda(non=5Fblocking)?= =?UTF-8?q?=20for=20Python=20>=3D=203.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #125 __async__ is a reserved word in Python 3.7 and later. To fix this pytorch/pytorch#4999 changed __cuda(async=True)__ to __cuda(non_blocking=True)__ so this PR tracks with that change which landed in PyTourch 0.4.1. --- lib/nn/parallel/data_parallel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nn/parallel/data_parallel.py b/lib/nn/parallel/data_parallel.py index 0ffbfb6d..8e9b72b8 100644 --- a/lib/nn/parallel/data_parallel.py +++ b/lib/nn/parallel/data_parallel.py @@ -13,7 +13,7 @@ def async_copy_to(obj, dev, main_stream=None): if torch.is_tensor(obj): obj = Variable(obj) if isinstance(obj, Variable): - v = obj.cuda(dev, async=True) + v = obj.cuda(dev, non_blocking=True) if main_stream is not None: v.data.record_stream(main_stream) return v