Skip to content

Conversation

@MartinuzziFrancesco
Copy link
Contributor

@MartinuzziFrancesco MartinuzziFrancesco commented Dec 24, 2024

Addressing the return_state as discussed in #2514.

PR Checklist

  • Tests are added
  • Entry in NEWS.md
  • Documentation, if applicable

@MartinuzziFrancesco MartinuzziFrancesco marked this pull request as ready for review December 25, 2024 17:50
@CarloLucibello
Copy link
Member

tests are failing

@MartinuzziFrancesco
Copy link
Contributor Author

MartinuzziFrancesco commented Dec 26, 2024

is this something that has to be addressed at the Functor level? the fail is at https://github.com/FluxML/Flux.jl/blob/master/test/test_utils.jl#L66 with

MethodError: no method matching RNN(::RNNCell{typeof(tanh), Matrix{Float64}, Matrix{Float64}, Vector{Float64}})

so I guess it's trying to rebuild the struct but it can't since it doesn't have the return_state parametrization information. I can add a workaround like

RNN(rnn::RNNCell) = RNN{false, RNNCell}(rnn)

but this wouldn't solve it at the level that it's needed. The tests would still fail for return_state = true

@CarloLucibello
Copy link
Member

yes this needs a custom functor implementation. Maybe something like

Functors.functor(rnn::RNN{S}) = (; rnn.cell), ch -> RNN{S}(ch.cell)

(not tested)

@mcabbott mcabbott added the RNN label Dec 31, 2024
@codecov
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.53%. Comparing base (7a3eafd) to head (710fb10).
Report is 7 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2557       +/-   ##
===========================================
+ Coverage   32.50%   65.53%   +33.02%     
===========================================
  Files          34       34               
  Lines        2003     2083       +80     
===========================================
+ Hits          651     1365      +714     
+ Misses       1352      718      -634     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@CarloLucibello CarloLucibello merged commit d79811a into FluxML:master Jan 9, 2025
8 of 11 checks passed
@CarloLucibello CarloLucibello mentioned this pull request Jan 9, 2025
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants