You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/10/11 15:37:52 UTC

[GitHub] lostella commented on issue #12795: Deserialization problem with gluon `ValueError: There are multiple outputs with name ...`

lostella commented on issue #12795: Deserialization problem with gluon `ValueError: There are multiple outputs with name ...`
URL: https://github.com/apache/incubator-mxnet/issues/12795#issuecomment-429003322
 
 
   Looks like the problem occurs with `Dense` as well, so the issue probably lies in the `+`:
   
   ```
   import mxnet as mx
   
   class MyBlock(mx.gluon.HybridBlock):
       def __init__(self):
           super().__init__()
           with self.name_scope():
               self.model = mx.gluon.nn.Dense(units=5)
   
       def hybrid_forward(self, F, x, y):
           return self.model(x) + self.model(y)
   
   block = MyBlock()
   block.initialize()
   block.hybridize()
   
   output = block(mx.nd.random_normal(shape=(100,)), mx.nd.random_normal(shape=(100,)))
   
   block.export(path="./model", epoch=0)
   symbol = mx.gluon.SymbolBlock.imports(
       symbol_file="./model-symbol.json",
       input_names=["data0", "data1"],
       param_file="./model-0000.params",
       ctx=mx.Context.default_ctx
   )
   ```
   
   gives
   
   ```
   Traceback (most recent call last):
     File "2018-10-11-very-weird-issue.py", line 23, in <module>
       ctx=mx.Context.default_ctx
     File "[...]/lib/python3.6/site-packages/mxnet/gluon/block.py", line 1023, in imports
       ret = SymbolBlock(sym, inputs)
     File "[...]/lib/python3.6/site-packages/mxnet/gluon/block.py", line 1051, in __init__
       for j in i.get_internals():
     File "[...]/lib/python3.6/site-packages/mxnet/symbol/symbol.py", line 93, in <genexpr>
       return (self[i] for i in self.list_outputs())
     File "[...]/lib/python3.6/site-packages/mxnet/symbol/symbol.py", line 517, in __getitem__
       raise ValueError('There are multiple outputs with name \"%s\"' % index)
   ValueError: There are multiple outputs with name "myblock0_dense0_fwd_output"
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services