gospodima opened a new issue #20799:
URL: https://github.com/apache/incubator-mxnet/issues/20799


   ## Description
   I had the same error as described in several issues here: #18923, #16590, 
#20317 and [here](https://github.com/onnx/onnx-mxnet/issues/54)
   By investigating the code, I came up with an idea that the probable problem 
of the KeyError issues is that during inputs initialization only `self._nodes` 
are considered (where graph inputs and node outputs are stored), however, some 
inputs can be also stored in initializer according to onnx 
[documentation](https://github.com/onnx/onnx/blob/master/docs/IR.md):
   
   > Names of the values used by the node to propagate input values to the node 
operator. It must refer to either a graph input, a graph initializer or a node 
output. 
   
   I tried to replace `inputs = [self._nodes[i] for i in node.input]` with:
   ```python
   inputs = []
   for i in node.input:
       try:
           inputs.append(self._nodes[i])
       except KeyError:
           inputs.append(symbol.Variable(name=i, shape=self._params[i].shape))
   ```
   And it looks like import is successfull then (i.e. all not found keys are 
actually found in params). But of course I don't initialize variable weights 
here. Unfortunately, I am not really advanced with mxnet and couldn't find a 
working way to initialize `symbol.Variable` with `NDArray`.
   
   If it is possible to initialize variable with an array, it might be a 
working solution for this issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@mxnet.apache.org
For additional commands, e-mail: issues-h...@mxnet.apache.org

Reply via email to