Skip to content

Commit 7494652

Browse files
author
noklam
committed
Add checking for __module__ =='torch'
1 parent f1ed689 commit 7494652

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tsensor/analysis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ def istensor(x):
455455

456456
def _shape(v):
457457
# do we have a shape and it answers len()? Should get stuff right.
458-
if hasattr(v, "shape") and hasattr(v.shape,"__len__"):
459-
if type(v.shape).__name__ == "Size":
458+
if hasattr(v, "shape") and hasattr(v.shape, "__len__"):
459+
if v.shape.__class__.__module__ == "torch" and v.shape.__class__.__name__ == "Size":
460460
if len(v.shape)==0:
461461
return None
462462
return list(v.shape)

0 commit comments

Comments
 (0)