We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f2e89ed + 2c46a54 commit cec8fb6Copy full SHA for cec8fb6
tsensor/analysis.py
@@ -24,7 +24,6 @@
24
import os
25
import sys
26
import traceback
27
-import torch
28
import inspect
29
import hashlib
30
@@ -456,8 +455,8 @@ def istensor(x):
456
455
457
def _shape(v):
458
# do we have a shape and it answers len()? Should get stuff right.
459
- if hasattr(v, "shape") and hasattr(v.shape,"__len__"):
460
- if isinstance(v.shape, torch.Size):
+ if hasattr(v, "shape") and hasattr(v.shape, "__len__"):
+ if v.shape.__class__.__module__ == "torch" and v.shape.__class__.__name__ == "Size":
461
if len(v.shape)==0:
462
return None
463
return list(v.shape)
0 commit comments