Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save failed with the error: " expected Type, got Type{Vararg{Any,N} where N}" #18

Open
mslichao opened this issue Oct 29, 2018 · 0 comments

Comments

@mslichao
Copy link

I use BSON in Flux to save/load my model, it works well when I save the origin model. But it failed when I save the model which load from file.

Below is the code, the last line failed.

using BSON: @save, @load
a=1
@save "a.bson" a
@load "a.bson" a
@save "a.bson" a    # works well

using Flux
m = Dense(10, 5)
@save "m.bson" m    # works well
@load "m.bson" m
@save "m.bson" m    # TypeError: in Type, in parameter, expected Type, got Type{Vararg{Any,N} where N}

Stack trace:

Stacktrace:
 [1] typeof_ at D:\julia\.julia\packages\BSON\kxdIr\src\write.jl:50 [inlined]
 [2] _lower_recursive(::Type, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\packages\BSON\kx
dIr\src\write.jl:54
 [3] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::Type) at D:\julia\.julia\p
ackages\BSON\kxdIr\src\write.jl:62
 [4] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Array{Any,1}
) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:28
 [5] _lower_recursive(::Array{UnionAll,1}, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\pac
kages\BSON\kxdIr\src\write.jl:62
 [6] (::getfield(BSON, Symbol("##5#9")){IdDict{Any,Any},Array{Any,1}})(::Array{UnionAll,1}) at D:\ju
lia\.julia\packages\BSON\kxdIr\src\write.jl:53
 [7] applychildren!(::getfield(BSON, Symbol("##5#9")){IdDict{Any,Any},Array{Any,1}}, ::Dict{Symbol,A
ny}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:21
 [8] (::getfield(BSON, Symbol("#_lower#8")){IdDict{Any,Any},Array{Any,1}})(::Type) at D:\julia\.juli
a\packages\BSON\kxdIr\src\write.jl:53
 [9] _lower_recursive(::Type, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\packages\BSON\kx
dIr\src\write.jl:54
 [10] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::Type) at D:\julia\.julia\
packages\BSON\kxdIr\src\write.jl:62
 [11] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Array{Any,1
}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:28
 [12] _lower_recursive(::Array{DataType,1}, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\pa
ckages\BSON\kxdIr\src\write.jl:62
 [13] (::getfield(BSON, Symbol("##5#9")){IdDict{Any,Any},Array{Any,1}})(::Array{DataType,1}) at D:\j
ulia\.julia\packages\BSON\kxdIr\src\write.jl:53
 [14] applychildren!(::getfield(BSON, Symbol("##5#9")){IdDict{Any,Any},Array{Any,1}}, ::Dict{Symbol,
Any}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:21
 [15] (::getfield(BSON, Symbol("#_lower#8")){IdDict{Any,Any},Array{Any,1}})(::Type) at D:\julia\.jul
ia\packages\BSON\kxdIr\src\write.jl:53
 [16] _lower_recursive(::Type, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\packages\BSON\k
xdIr\src\write.jl:54
 [17] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::Type) at D:\julia\.julia\
packages\BSON\kxdIr\src\write.jl:62
 [18] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Dict{Symbol
,Any}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:21
 [19] _lower_recursive(::Flux.Tracker.Call{Nothing,Tuple}, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\
julia\.julia\packages\BSON\kxdIr\src\write.jl:62
 [20] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::Flux.Tracker.Call{Nothing
,Tuple}) at D:\julia\.julia\packages\BSON\kxdIr\src\write.jl:62
 [21] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Array{Any,1
}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:28
 [22] _lower_recursive(::Array{Any,1}, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\package
s\BSON\kxdIr\src\write.jl:62
 [23] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::Array{Any,1}) at D:\julia
\.julia\packages\BSON\kxdIr\src\write.jl:62
 [24] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Dict{Symbol
,Any}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:21
 [25] _lower_recursive(::Flux.Tracker.Tracked{Array{Float64,2}}, ::IdDict{Any,Any}, ::Array{Any,1})
at D:\julia\.julia\packages\BSON\kxdIr\src\write.jl:62
 [26] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::Flux.Tracker.Tracked{Arra
y{Float64,2}}) at D:\julia\.julia\packages\BSON\kxdIr\src\write.jl:62
 [27] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Array{Any,1
}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:28
 [28] _lower_recursive(::Array{Any,1}, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\package
s\BSON\kxdIr\src\write.jl:62
 [29] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::Array{Any,1}) at D:\julia
\.julia\packages\BSON\kxdIr\src\write.jl:62
 [30] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Dict{Symbol
,Any}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:21
 [31] _lower_recursive(::TrackedArray{…,Array{Float64,2}}, ::IdDict{Any,Any}, ::Array{Any,1}) at D:
\julia\.julia\packages\BSON\kxdIr\src\write.jl:62
 [32] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::TrackedArray{…,Array{Flo
at64,2}}) at D:\julia\.julia\packages\BSON\kxdIr\src\write.jl:62
 [33] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Array{Any,1
}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:28
 [34] _lower_recursive(::Array{Any,1}, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\package
s\BSON\kxdIr\src\write.jl:62
 [35] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::Array{Any,1}) at D:\julia
\.julia\packages\BSON\kxdIr\src\write.jl:62
 [36] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Dict{Symbol
,Any}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:21
 [37] _lower_recursive(::Dense{typeof(identity),TrackedArray{…,Array{Float64,2}},TrackedArray{…,Ar
ray{Float64,1}}}, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\packages\BSON\kxdIr\src\writ
e.jl:62
 [38] (::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}})(::Dense{typeof(identity),Tr
ackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}) at D:\julia\.julia\packages\BSON
\kxdIr\src\write.jl:62
 [39] applychildren!(::getfield(BSON, Symbol("##7#11")){IdDict{Any,Any},Array{Any,1}}, ::Dict{Symbol
,Any}) at D:\julia\.julia\packages\BSON\kxdIr\src\BSON.jl:21
 [40] _lower_recursive(::Dict{Symbol,Dense{typeof(identity),TrackedArray{…,Array{Float64,2}},Tracke
dArray{…,Array{Float64,1}}}}, ::IdDict{Any,Any}, ::Array{Any,1}) at D:\julia\.julia\packages\BSON\k
xdIr\src\write.jl:62
 [41] lower_recursive(::Dict{Symbol,Dense{typeof(identity),TrackedArray{…,Array{Float64,2}},Tracked
Array{…,Array{Float64,1}}}}) at D:\julia\.julia\packages\BSON\kxdIr\src\write.jl:73
 [42] bson(::IOStream, ::Dict{Symbol,Dense{typeof(identity),TrackedArray{…,Array{Float64,2}},Tracke
dArray{…,Array{Float64,1}}}}) at D:\julia\.julia\packages\BSON\kxdIr\src\write.jl:81
 [43] #14 at D:\julia\.julia\packages\BSON\kxdIr\src\write.jl:83 [inlined]
 [44] #open#294(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function,
::getfield(BSON, Symbol("##14#15")){Dict{Symbol,Dense{typeof(identity),TrackedArray{…,Array{Float64
,2}},TrackedArray{…,Array{Float64,1}}}}}, ::String, ::Vararg{String,N} where N) at .\iostream.jl:36
9
 [45] open at .\iostream.jl:367 [inlined]
 [46] bson(::String, ::Dict{Symbol,Dense{typeof(identity),TrackedArray{…,Array{Float64,2}},TrackedA
rray{…,Array{Float64,1}}}}) at D:\julia\.julia\packages\BSON\kxdIr\src\write.jl:83
 [47] top-level scope at none:0
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

No branches or pull requests

1 participant