I have the following training data in CuArrays. (我在CuArrays中有以下训练数据。)
X: 300×8544 CuArray{Float32,2,Nothing}
y: 5×8544 Flux.OneHotMatrix{CuArray{Flux.OneHotVector,1,Nothing}}
and I have the following model I want to train: (我想训练以下模型:)
# define activation
logistic(x) = 1. / (1 .+ exp.(-x))
# first define a 2-layer MLP model
model = Chain(Dense(300, 64, logistic),
Dense(64, c),
softmax) |> gpu
# define the loss
loss(x, y) = Flux.crossentropy(model(x), y)
# define the optimiser
optimiser = ADAM()
but if I do (但是如果我这样做)
Flux.train!(loss, params(model), zip(X, y), optimiser)
I get the following error: (我收到以下错误:)
MethodError: no method matching (::Dense{typeof(logistic),CuArray{Float32,2,Nothing},CuArray{Float32,1,Nothing}})(::Float32)
How should I resolve this? (我该如何解决?)
ask by D.Danier translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…