You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -118,8 +117,6 @@ pad!(vect::Vector{T}) where {T} = push!(vect, zero(T))
118
117
end
119
118
elseif traces_signature <:Tuple
120
119
traces_signature = traces_signature.parameters
121
-
122
-
123
120
for tr in traces_signature
124
121
if!(tr <:MultiplexTraces)
125
122
#push a duplicate of last element as a dummy element, should never be sampled.
@@ -148,7 +145,7 @@ function Base.push!(eb::EpisodesBuffer, xs::NamedTuple)
148
145
push!(eb.episodes_lengths, 0)
149
146
push!(eb.sampleable_inds, 0)
150
147
elseif!partial #typical inserting
151
-
ifhaskey(eb,:next_action) &&length(eb) <max_length(eb) # if trace has next_action and lengths are mismatched
148
+
ifhaskey(eb,:next_action) # if trace has next_action
152
149
if eb.step_numbers[end] >1# and if there are sufficient steps in the current episode
153
150
eb.sampleable_inds[end-1] =1# steps are indexable one step later
154
151
end
@@ -171,33 +168,11 @@ function Base.push!(eb::EpisodesBuffer, xs::NamedTuple)
171
168
returnnothing
172
169
end
173
170
174
-
function Base.push!(eb::EpisodesBuffer, xs::PartialNamedTuple) #wrap a NamedTuple to push without incrementing the step number.
175
-
push!(eb.traces, xs.namedtuple)
176
-
eb.sampleable_inds[end-1] =1#completes the episode trajectory.
177
-
end
178
-
179
-
function Base.push!(eb::EpisodesBuffer{<:Any,<:Any,<:CircularArraySARTSATraces}, xs::PartialNamedTuple)
180
-
ifmax_length(eb) ==capacity(eb.traces)
181
-
popfirst!(eb)
182
-
end
171
+
function Base.push!(eb::EpisodesBuffer, xs::PartialNamedTuple) #wrap a NamedTuple to push without incrementing the step number.
183
172
push!(eb.traces, xs.namedtuple)
184
173
eb.sampleable_inds[end-1] =1#completes the episode trajectory.
185
174
end
186
175
187
-
function Base.push!(eb::EpisodesBuffer{<:Any,<:Any,<:CircularPrioritizedTraces{<:CircularArraySARTSATraces}}, xs::PartialNamedTuple{@NamedTuple{action::Int64}})
188
-
ifmax_length(eb) ==capacity(eb.traces)
189
-
addition = (name =>zero(eltype(eb.traces[name])) for name in [:state, :reward, :terminal])
0 commit comments