From 04a2a4653ab1ec9f126565d10448fb0c70dc3f19 Mon Sep 17 00:00:00 2001 From: Pengzhi Gao Date: Wed, 8 May 2019 11:07:14 -0400 Subject: [PATCH] fix bug in get_rank() --- texar/utils/shapes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/texar/utils/shapes.py b/texar/utils/shapes.py index 4e7b1d665..f2e87b8d9 100644 --- a/texar/utils/shapes.py +++ b/texar/utils/shapes.py @@ -68,7 +68,7 @@ def get_rank(tensor: torch.Tensor) -> int: `None` if the rank cannot be determined. """ if torch.is_tensor(tensor): - rank = len(tensor.dim()) + rank = tensor.dim() else: array = np.asarray(tensor) rank = array.ndim