From 2c8842a59d3501134a4ab9293720e54f2737a4a0 Mon Sep 17 00:00:00 2001 From: David Earnest <47009968+earnesdm@users.noreply.github.com> Date: Mon, 26 Dec 2022 11:21:04 -0500 Subject: [PATCH] Update replay_buffer.py Using __len__ with the old code returns "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()". I believe that line 21 is trying to check if the list is None. If so, this is a better way. --- hw1/cs285/infrastructure/replay_buffer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw1/cs285/infrastructure/replay_buffer.py b/hw1/cs285/infrastructure/replay_buffer.py index 60148e79a..0fce19e79 100644 --- a/hw1/cs285/infrastructure/replay_buffer.py +++ b/hw1/cs285/infrastructure/replay_buffer.py @@ -18,7 +18,7 @@ def __init__(self, max_size=1000000): self.terminals = None def __len__(self): - if self.obs: + if self.obs is not None: return self.obs.shape[0] else: return 0