Skip to content

Commit b0e7e85

Browse files
Simplify FluxApproximator's optimise! method by using a single-line function definition
1 parent de3652d commit b0e7e85

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/ReinforcementLearningCore/src/policies/learners/flux_approximator.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,5 @@ Flux.@layer FluxApproximator trainable=(model,)
4343
forward(A::FluxApproximator, args...; kwargs...) = A.model(args...; kwargs...)
4444
forward(A::FluxApproximator, env::E, player::AbstractPlayer=current_player(env)) where {E <: AbstractEnv} = env |> (x -> state(x, player)) |> (x -> forward(A, x))
4545

46-
function RLBase.optimise!(A::FluxApproximator, grad::NamedTuple)
47-
48-
Flux.Optimise.update!(A.optimiser_state, A.model, grad.model)
49-
end
46+
RLBase.optimise!(A::FluxApproximator, grad::NamedTuple) = Flux.Optimise.update!(A.optimiser_state, A.model, grad.model)
5047

0 commit comments

Comments
 (0)