Skip to content

Update memory_index once per batch, not per tensor#328

Open
AlexD15216 wants to merge 1 commit into
Toni-SM:developfrom
AlexD15216:fix/memory_index-updating
Open

Update memory_index once per batch, not per tensor#328
AlexD15216 wants to merge 1 commit into
Toni-SM:developfrom
AlexD15216:fix/memory_index-updating

Conversation

@AlexD15216

Copy link
Copy Markdown
Contributor

The write pointer was being incremented inside the for-loop that iterates
over every tensor in the batch. When more than one tensor is present (common situation in RL), this
advanced the pointer multiple times for the same batch, leaving gaps and
eventually skipping slots in the ring buffer.

Because all tensors share the same first dimension (batch size), the
pointer should move once after the entire batch has been copied.
The increment logic is now placed after the loop so the index grows
by num_samples exactly once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant