bugfix for hang in list(Batch()) (#117)
This commit is contained in:
parent
f5e007932f
commit
481015932c
@ -433,6 +433,14 @@ class Batch:
|
|||||||
"""Return self[k] if k in self else d. d defaults to None."""
|
"""Return self[k] if k in self else d. d defaults to None."""
|
||||||
return self.__dict__.get(k, d)
|
return self.__dict__.get(k, d)
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
try:
|
||||||
|
length = len(self)
|
||||||
|
except Exception:
|
||||||
|
length = 0
|
||||||
|
for i in range(length):
|
||||||
|
yield self[i]
|
||||||
|
|
||||||
def to_numpy(self) -> None:
|
def to_numpy(self) -> None:
|
||||||
"""Change all torch.Tensor to numpy.ndarray. This is an in-place
|
"""Change all torch.Tensor to numpy.ndarray. This is an in-place
|
||||||
operation.
|
operation.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user