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

UndefVarError: stride=(2, 2) not defined when loading ResNet #42

Open
natema opened this issue Jun 15, 2020 · 2 comments
Open

UndefVarError: stride=(2, 2) not defined when loading ResNet #42

natema opened this issue Jun 15, 2020 · 2 comments

Comments

@natema
Copy link

natema commented Jun 15, 2020

I downloaded resnet18 from here, and run, in the onnx file's folder

ONNX.load_model("resnet18-v1-7.onnx")
weights = ONNX.load_weights("weights.bson") ;
model = include("model.jl")

which results in

julia> model = include("model.jl")
ERROR: LoadError: UndefVarError: stride=(2, 2) not defined
Stacktrace:
 [1] top-level scope at /mypath🙂/models/model.jl:6
 [2] include(::String) at ./client.jl:439
 [3] top-level scope at REPL[44]:1
in expression starting at /mypath🙂/models/model.jl:4

Any idea?

@natema
Copy link
Author

natema commented Jun 16, 2020

I made some (apparent) progress by looking at this issue.

In the model.jl file produced by this package, I removed the enclosing var"..." from all statements of the type
var"stride=(2, 2)", var"pad=(3, 3, 3, 3)" and var"dilation=(1, 1)".
(I also tried to comment the function Mul and Add, which appear irrelevant.)
Now when I try to feed to the model a zeros(224,224,3,1) tensor, it complains that

ERROR: ArgumentError: At least one of `length` or `step` must be specified
Stacktrace:
 [1] _range2(::Int64, ::Nothing, ::Int64, ::Nothing) at ./range.jl:94
 [2] range(::Int64, ::Int64; length::Nothing, step::Nothing) at ./range.jl:91
 [3] range(::Int64, ::Int64) at ./range.jl:91
 [4] (::var"#25#26")(::Array{Float64,4}) at /😎/models/model.jl:59
 [5] top-level scope at REPL[31]:1

@Paethon
Copy link

Paethon commented Jul 25, 2020

Same problem when loading ResNet50 with error UndefVarError: stride=(1, 1) not defined

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

2 participants