Skip to content

Implement _show_leaflike(::Tuple{}) to handle parameters consisting of an empty Tuple#2667

Merged
CarloLucibello merged 1 commit into
FluxML:masterfrom
JoshuaBillson:master
Mar 31, 2026
Merged

Implement _show_leaflike(::Tuple{}) to handle parameters consisting of an empty Tuple#2667
CarloLucibello merged 1 commit into
FluxML:masterfrom
JoshuaBillson:master

Conversation

@JoshuaBillson
Copy link
Copy Markdown
Contributor

Given a layer with a parameter of type Tuple{}, the following error is thrown when attempting to show it:

ERROR: MethodError: _show_leaflike(::Tuple{}) is ambiguous.

Candidates:
  _show_leaflike(::Tuple{Vararg{AbstractArray}})
    @ Flux ~/.julia/packages/Flux/3711C/src/layers/show.jl:73
  _show_leaflike(::Tuple{Vararg{Number}})
    @ Flux ~/.julia/packages/Flux/3711C/src/layers/show.jl:72

Possible fix, define
  _show_leaflike(::Tuple{})

I've added the method _show_leaflike(::Tuple{}) = true, which appears to resolve the issue.

I don't know if it's appropriate to add new documentation and an entry in NEWS.md for this, but I can do so if requested.

PR Checklist

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

@CarloLucibello CarloLucibello merged commit 0ab52e6 into FluxML:master Mar 31, 2026
4 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants