Skip to content

Commit f1ed689

Browse files
author
noklam
committed
avoding torch dependecies, checking type.__name__ instead of th e instance
1 parent 6a32030 commit f1ed689

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tsensor/analysis.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import os
2525
import sys
2626
import traceback
27-
import torch
2827
import inspect
2928
import hashlib
3029

@@ -457,7 +456,7 @@ def istensor(x):
457456
def _shape(v):
458457
# do we have a shape and it answers len()? Should get stuff right.
459458
if hasattr(v, "shape") and hasattr(v.shape,"__len__"):
460-
if isinstance(v.shape, torch.Size):
459+
if type(v.shape).__name__ == "Size":
461460
if len(v.shape)==0:
462461
return None
463462
return list(v.shape)

0 commit comments

Comments
 (0)