运行regression-example.jl的代码失败并出现以下错误:
MethodError: no method matching (::MXNet.mx.var"#5784#5785")(::Float64, ::NDArray{Float32,1})
Closest candidates are:
#5784(::Any) at /Users/**********/.julia/packages/MXNet/XoVCW/src/metric.jl:263
Stacktrace:
[1] (::Base.var"#3#4"{MXNet.mx.var"#5784#5785"})(::Tuple{Float64,NDArray{Float32,1}}) at ./generator.jl:36
[2] iterate at ./generator.jl:47 [inlined]
[3] mapfoldl_impl(::Function, ::Function, ::NamedTuple{(),Tuple{}}, ::Base.Generator{Base.Iterators.Zip{Tuple{Float64,Array{NDArray{Float32,1},1}}},Base.var"#3#4"{MXNet.mx.var"#5784#5785"}}) at ./reduce.jl:55
[4] #mapfoldl#186 at ./reduce.jl:72 [inlined]
[5] mapfoldl at ./reduce.jl:72 [inlined]
[6] #mapreduce#194 at ./reduce.jl:200 [inlined]
[7] mapreduce at ./reduce.jl:200 [inlined]
[8] #reduce#196 at ./reduce.jl:357 [inlined]
[9] reduce(::Function, ::Base.Generator{Base.Iterators.Zip{Tuple{Float64,Array{NDArray{Float32,1},1}}},Base.var"#3#4"{MXNet.mx.var"#5784#5785"}}) at ./reduce.jl:357
[10] #mapreduce#195(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(mapreduce), ::Function, ::Function, ::Float64, ::Vararg{Any,N} where N) at ./reduce.jl:201
[11] mapreduce(::Function, ::Function, ::Float64, ::Array{NDArray{Float32,1},1}) at ./reduce.jl:201
[12] get(::MSE{1}) at /Users/*******/.julia/packages/MXNet/XoVCW/src/metric.jl:263
[13] #fit#5876(::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:initializer, :eval_metric, :eval_data, :n_epoch, :callbacks),Tuple{NormalInitializer,MSE{1},ArrayDataProvider{Float32,2},Int64,Array{MXNet.mx.BatchCallback,1}}}}, ::typeof(MXNet.mx.fit), ::FeedForward, ::ADAM, ::ArrayDataProvider{Float32,2}) at /Users/********/.julia/packages/MXNet/XoVCW/src/model.jl:545
[14] (::MXNet.mx.var"#kw##fit")(::NamedTuple{(:initializer, :eval_metric, :eval_data, :n_epoch, :callbacks),Tuple{NormalInitializer,MSE{1},ArrayDataProvider{Float32,2},Int64,Array{MXNet.mx.BatchCallback,1}}}, ::typeof(MXNet.mx.fit), ::FeedForward, ::ADAM, ::ArrayDataProvider{Float32,2}) at ./none:0
[15] top-level scope at In[33]:81
一段关键的代码失败:
mx.fit(model, optimizer, trainprovider,
initializer = mx.NormalInitializer(0.0, 0.1),
eval_metric = mx.MSE(),
eval_data = evalprovider,
n_epoch = 20,
callbacks = [mx.speedometer()])
我怀疑这个问题与mx.MSE()
使用有关,但我不知道如何解决它,特别是没有很好的 MXNet.jl 文档