I am getting started with Flux and learning machine learning and Julia at the same time. So I had a look at some examples and loading MNIST and running stuff in Jupyter and that works fine for me. I started experimenting with the simplest possible model to see that I understand things correctly. I am using simplest possible Softmax (ie multidimentional logistic regression) with and without my own initialization like this:
model1LRi = Chain(
# Dense(784, 10),
Dense(W, -W*m), # 784 x 10 + 10 = 7850 parameters
softmax
)
and then optimizing it with either Descent or ADAM like this:
optimizer = Descent(0.1) # ADAM(0.001)
train_data = [(train_x, train_y)]
for i in 0:400
if i % 25 == 0 println(i, " ", loss1LRi(train_x, train_y)) end
Flux.train!(loss1LRi, params1LRi, train_data, optimizer)
end
Now all combinations work EXCEPT if I initialize the model and use ADAM. Then it says
TypeError: in typeassert, expected Tuple{Transpose{Float32, Matrix{Float32}}, Transpose{Float32, Matrix{Float32}}, Vector{Float64}}, got a value of type Tuple{Matrix{Float32}, Matrix{Float32}, Vector{Float64}}
Stacktrace:
[1] apply!(o::Adam, x::Transpose{Float32, Matrix{Float32}}, Δ::Matrix{Float32})
@ Flux.Optimise ~/.julia/packages/Flux/KkC79/src/optimise/optimisers.jl:179
[2] update!(opt::Adam, x::Transpose{Float32, Matrix{Float32}}, x̄::Matrix{Float32})
@ Flux.Optimise ~/.julia/packages/Flux/KkC79/src/optimise/train.jl:18
[...]
What did I do wrong?
EDIT: It also says
WARNING: both Losses and NNlib export "ctc_loss"; uses of it in module Flux must be qualified
Huh?