mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-10 18:42:19 +00:00
consider case of empty tensor (#540)
This commit is contained in:
parent
9277c95bcd
commit
c0101185d7
@ -130,6 +130,8 @@ class TensorDiagnostic(object):
|
|||||||
x = x[0]
|
x = x[0]
|
||||||
if not isinstance(x, Tensor):
|
if not isinstance(x, Tensor):
|
||||||
return
|
return
|
||||||
|
if x.numel() == 0: # for empty tensor
|
||||||
|
return
|
||||||
x = x.detach().clone()
|
x = x.detach().clone()
|
||||||
if x.ndim == 0:
|
if x.ndim == 0:
|
||||||
x = x.unsqueeze(0)
|
x = x.unsqueeze(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user