Skip to content

Commit 03058af

Browse files
Roy LiRob Kunkle
Roy Li
authored and
Rob Kunkle
committed
Fix dir(torch) for python 3.7 (pytorch#10271)
Summary: fixes pytorch#10160. Pull Request resolved: pytorch#10271 Differential Revision: D9188031 Pulled By: li-roy fbshipit-source-id: a3620553a8ba2b7391acdf78dbe58afcdb6c5f7f
1 parent d9f0852 commit 03058af

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

test/test_torch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ def make_contiguous_slice(size, dtype):
143143

144144
return tensors
145145

146+
def test_dir(self):
147+
dir(torch)
148+
146149
def test_dot(self):
147150
types = {
148151
'torch.DoubleTensor': 1e-8,

torch/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ def manager_path():
251251
del manager_path
252252

253253
for name in dir(_C._VariableFunctions):
254+
if name in ["__dir__", "__doc__"]:
255+
continue
254256
globals()[name] = getattr(_C._VariableFunctions, name)
255257

256258
################################################################################

0 commit comments

Comments
 (0)