Description
Apparently @owainkenwayucl was trying out Flux, and @giordano was helping him out.
https://twitter.com/owainkenway/status/1620771011863121921
https://github.com/owainkenwayucl/JuliaML/blob/main/Fashion/simple.jl
Edit: now at https://www.youtube.com/watch?v=Yd1JkPljpbY
It's useful to see what problems newcomers run into. Especially people new to Julia.
-
Scope issues like
global a_sum_ = a_sum_ + 1
are weird. Flux's tutorials tend to define many functions to put everything in local scope... maybe too many... but for this common use, perhaps Flux ought to have anaccuracy
function instead of every tutorial rolling its own? -
Wrong array dimensions give pretty confusing errors. Perhaps Flux layers should catch more of them, instead of waiting for
*
etc. Some made-up examples (but examples from the wild might be different):
julia> Conv((3,3),3=>4)(rand(10,10,3)) # reasonable to try, maybe it should just work
ERROR: DimensionMismatch: Rank of x and w must match! (3 vs. 4)
julia> Conv((3,3),3=>4)(rand(10,10,2,1)) # error could print out which Conv layer, and size of input, etc.
ERROR: DimensionMismatch: Input channels must match! (2 vs. 3)
julia> Dense(2,3)(rand(4)) # error could be from Dense, there is no matrix called A in user code
ERROR: DimensionMismatch: second dimension of A, 2, does not match length of x, 4
- Perhaps we can encourage more use of
outputsize
for understanding array sizes. There could be some way to get an overview of the whole model, like this: https://flax.readthedocs.io/en/latest/getting_started.html#view-model-layers . The defaultshow
doesn't know the input size, at present, so it can't tell you all of this. One idea would be to give Chain a mutable field in which to store the most recent input size?