File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,11 @@ function Base.push!(eb::EpisodesBuffer, xs::NamedTuple)
95
95
push! (eb. episodes_lengths, 0 )
96
96
push! (eb. sampleable_inds, 0 )
97
97
elseif ! partial # typical inserting
98
- eb. sampleable_inds[end ] = 1 # previous step is now indexable
98
+ if length (eb. traces) < length (eb) && length (eb) > 2 # case when PartialNamedTuple is used. Steps are indexable one step later
99
+ eb. sampleable_inds[end - 1 ] = 1
100
+ else # case when we don't, length of traces and eb will match.
101
+ eb. sampleable_inds[end ] = 1 # previous step is now indexable
102
+ end
99
103
push! (eb. sampleable_inds, 0 ) # this one is no longer
100
104
ep_length = last (eb. step_numbers)
101
105
push! (eb. episodes_lengths, ep_length)
114
118
115
119
function Base. push! (eb:: EpisodesBuffer , xs:: PartialNamedTuple ) # wrap a NamedTuple to push without incrementing the step number.
116
120
push! (eb. traces, xs. namedtuple)
121
+ eb. sampleable_inds[end - 1 ] = 1 # completes the episode trajectory.
117
122
end
118
123
119
124
#= currently unsupported due to lack of support of appending a named tuple to traces with multiplextraces.
You can’t perform that action at this time.
0 commit comments