reminisce commented on issue #14728: [MXNET-1386] fix for shape mismatch
URL: https://github.com/apache/incubator-mxnet/pull/14728#issuecomment-486462824
 
 
   @samskalicky You just need to check the order of input names. See the 
following script
   ```python
   import os
   import ctypes
   import mxnet as mx
   from collections import namedtuple
   from mxnet.base import _LIB, check_call, c_str, mx_uint, c_str_array, 
SymbolHandle
   Batch = namedtuple('Batch', ['data'])
   
   #setup whitelist
   op_names = ['elemwise_mul', '_plus', '_Plus']
   #os.environ['MXNET_SUBGRAPH_BACKEND'] = 'default'
   
   #setup graph
   e = mx.sym.var('e')
   f = mx.sym.var('f')
   c = mx.sym.var('c')
   h = mx.sym.var('h')
   k = mx.sym.var('k')
   
   d = e * f
   b = c * d
   g = h * d
   j = k + g
   a = b + j
   sym = a
   
   print(a.list_inputs())
   # result: ['c', 'e', 'f', 'k', 'h']
   
   subgraph_backend = 'default'
   out = SymbolHandle()
   check_call(_LIB.MXBuildSubgraphByOpNames(sym.handle, 
c_str(subgraph_backend), mx_uint(len(op_names)),
                                            c_str_array(op_names), 
ctypes.byref(out)))
   psym = mx.sym.Symbol(out)
   print(psym.list_inputs())
   # result: ['c', 'e', 'f', 'h', 'k']
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to