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

call mx.forward with kwargs occured an error. #431

Closed
ghost opened this issue Sep 10, 2019 · 3 comments · Fixed by apache/mxnet#16138
Closed

call mx.forward with kwargs occured an error. #431

ghost opened this issue Sep 10, 2019 · 3 comments · Fixed by apache/mxnet#16138

Comments

@ghost
Copy link

ghost commented Sep 10, 2019

julia> mx.forward(ex1, data=mydata)
ERROR: AbstractDict collections only contain Pairs;
Either look for e.g. A=>B instead, or use the keys or values
function if you are looking for a key or value respectively.

Enviroments:
julia 1.2.0
MXNet 1.5.0

@iblislin
Copy link
Member

iblislin commented Sep 11, 2019

Hi @bethetops ,
could you try this patch?

diff --git a/julia/src/executor.jl b/julia/src/executor.jl
index e56561797..37f2dde61 100644
--- a/julia/src/executor.jl
+++ b/julia/src/executor.jl
@@ -176,7 +176,7 @@ end
 
 function forward(self::Executor; is_train::Bool = false, kwargs...)
   for (k,v) in kwargs
-    @assert(k ∈ self.arg_dict, "Unknown argument $k")
+    @assert(k ∈ keys(self.arg_dict), "Unknown argument $k")
     @assert(isa(v, NDArray), "Keyword argument $k must be an NDArray")
     copy!(self.arg_dict[k], v)
   end

@ghost
Copy link
Author

ghost commented Sep 11, 2019

It works! Thank you.

@ghost ghost closed this as completed Sep 11, 2019
@iblislin
Copy link
Member

ah, but let this issue open until the PR got merged.

@iblislin iblislin reopened this Sep 11, 2019
iblislin added a commit to apache/mxnet that referenced this issue Sep 12, 2019
iblislin added a commit to apache/mxnet that referenced this issue Sep 12, 2019
larroy pushed a commit to larroy/mxnet that referenced this issue Sep 28, 2019
iblislin added a commit to apache/mxnet that referenced this issue Dec 17, 2019
* julia: bump window prebult binary version to v1.5.0 (#15608)

- remove file REQUIRE, it's stale for Pkg3.jl

* update julia install doc (#15609)

* julia: fix `mx.forward` kwargs checking (#16138)

close dmlc/MXNet.jl#431

* Julia: add API docs back (#16348)

`ndarray` and `symbolic-node` have been refactored by splitting into a
few files in commits ed83071 and 36a3cb8, but the corresponding
document setting for MXNet.jl is not updated yet.

List all split source files into the `at_autodoc` setting.

Also refer to the `at_autodoc` setting in `julia/docs/src/api/optimizer.md`
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

Successfully merging a pull request may close this issue.

1 participant