Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ml-agents/mlagents/trainers/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def padded_to_batch(
dimension is equal to the length of the AgentBufferField.
"""
if len(self) > 0 and not isinstance(self[0], list):
return np.asanyarray(self, dytpe=dtype)
return np.asanyarray(self, dtype=dtype)

shape = None
for _entry in self:
Expand Down
4 changes: 4 additions & 0 deletions ml-agents/mlagents/trainers/tests/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ def test_agentbufferfield():
assert np.array_equal(padded[0], np.array([1, 1, 1, 1]))
assert np.array_equal(padded[1], np.array([2, 2, 3, 3]))

# Make sure it doesn't fail when the field isn't a list
padded_a = a.padded_to_batch()
assert np.array_equal(padded_a, a)


def fakerandint(values):
return 19
Expand Down