@@ -20,18 +20,18 @@ Supported methoes are:
20
20
- `take!(t::Trajectory)`, take a batch of experiences from the trajectory. Note
21
21
that `nothing` may be returned, indicating that it's not ready to sample yet.
22
22
"""
23
- Base. @kwdef struct Trajectory{C,S,T}
23
+ Base. @kwdef struct Trajectory{C,S,T,F }
24
24
container:: C
25
25
sampler:: S = DummySampler ()
26
26
controller:: T = InsertSampleRatioController ()
27
- transformer:: Any = identity
27
+ transformer:: F = identity
28
28
29
29
function Trajectory (c:: C , s:: S , t:: T = InsertSampleRatioController (), f= identity) where {C,S,T}
30
30
if c isa EpisodesBuffer
31
- new {C,S,T} (c, s, t, f)
31
+ new {C,S,T,typeof(f) } (c, s, t, f)
32
32
else
33
33
eb = EpisodesBuffer (c)
34
- new {typeof(eb),S,T} (eb, s, t, f)
34
+ new {typeof(eb),S,T,typeof(f) } (eb, s, t, f)
35
35
end
36
36
end
37
37
@@ -63,7 +63,7 @@ Base.@kwdef struct Trajectory{C,S,T}
63
63
bind (controller. ch_in, t)
64
64
bind (controller. ch_out, t)
65
65
66
- new {C,S,T} (container, sampler, controller, transformer)
66
+ new {C,S,T,typeof(transformer) } (container, sampler, controller, transformer)
67
67
end
68
68
end
69
69
@@ -105,7 +105,7 @@ function Base.push!(t::Trajectory, x)
105
105
on_insert! (t, x)
106
106
end
107
107
108
- function Base. push! (t:: Trajectory , x:: PartialNamedTuple )
108
+ function Base. push! (t:: Trajectory , x:: PartialNamedTuple ) # used at EpisodesBuffer
109
109
push! (t. container, x)
110
110
on_insert! (t, x. namedtuple)
111
111
end
0 commit comments