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/05/31 03:39:24 UTC

[GitHub] HyperGroups commented on issue #11032: Problem with load lstm model with mx.Module's bind

HyperGroups commented on issue #11032: Problem with load lstm model with mx.Module's bind
URL: https://github.com/apache/incubator-mxnet/issues/11032#issuecomment-393391621
 
 
   @reminisce  I've add the [model link]
   
   In this method[here](MachineLearning/mxnet/python/1.0/script/wolfram_v1/wolfram.lstm.py), manually set some states params,
   
   
   ```
   import sys
   sys.path.append('..')
   # sys.path.append('../../')
   import numpy as np
   import PIL
   import os
   from myPath import *
   
   if __name__=='__main__':
       ctx=mx.cpu()
       from myPath import *
       file_sym=os.path.join(root_dir, 'model-wolfram/wolfram.lstm-symbol.json')
       file_nd=os.path.join(root_dir, 'model-wolfram/wolfram.lstm-0000.params')
   
       _sym= mx.symbol.load(file_sym)
       _nd= mx.nd.load(file_nd)
   
       _nd['4.State']=mx.nd.array([[0,0,0,0,0]])
       _nd['4.CellState']=mx.nd.array([[0,0,0,0,0]])
   
       input_data=np.array([[1,2]])
       print 'input_data', input_data
       array = mx.nd.array(input_data)
   
       _nd["Input"] = array
       _e = _sym.bind(ctx, _nd)
   
       _out = _e.forward()
       prob = _out[0].asnumpy()
       prob = np.squeeze(prob)
       print 'prob', prob
   ```

----------------------------------------------------------------
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