From 6b85c99ce562cf81749e5efc49bd835041e43f92 Mon Sep 17 00:00:00 2001 From: Santiago Castro Date: Mon, 30 Aug 2021 19:17:21 -0700 Subject: [PATCH] Avoid an unnecessary list creation in `DataChunk` (#64111) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64111 Reviewed By: mruberry Differential Revision: D30639383 Pulled By: ezyang fbshipit-source-id: 96b243307413c99a67d55d862a71937e1ef210f4 --- torch/utils/data/dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch/utils/data/dataset.py b/torch/utils/data/dataset.py index 7a069d6..609e1a1 100644 --- a/torch/utils/data/dataset.py +++ b/torch/utils/data/dataset.py @@ -31,7 +31,7 @@ class DataChunk(list, Generic[T]): self.items = items def as_str(self, indent=''): - res = indent + "[" + ", ".join([str(i) for i in iter(self)]) + "]" + res = indent + "[" + ", ".join(str(i) for i in iter(self)) + "]" return res def __iter__(self) -> Iterator[T]: -- 2.7.4