mxnet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [incubator-mxnet] reminisce opened a new pull request #14315: Shape support scalar tensor
Date Mon, 04 Mar 2019 07:31:40 GMT
reminisce opened a new pull request #14315: Shape support scalar tensor
   ## Description ##
   This PR made necessary changes in the shape-related infra code to support scalars, aka,
zero-dim tensors. 
   See this [RFC]( for more information.
   Implemented `np.sum` to verify the correctness with the following script.
   After merging this PR, we can get started to make all the existing infer shape functions
accommodate the new definition of empty shapes. Implementation of NumPy operators can be carried
out in parallel.
   Note that before we change all the existing infer functions to accommodate the new empty
shape definition, the CI will fail without surprise. When we work on specific operators, we
can test those locally to verify the correctness and submit PRs. After all the infer functions
are revised, the CI should pass eventually. Then, we can merge the dev branch to the master.
   import mxnet as mx
   from mxnet import numpy as np
   shape = (2, 2)
   ret = np.sum(mx.nd.ones(shape))
   print("Imperative invoke result==============")
   data = mx.sym.var('data', shape=shape)
   ret = mx.sym.numpy.sum(data)
   exe = ret.simple_bind(ctx=mx.cpu(), data=(2, 2))
   print("Symbol bind result===============")
   print("CachedOp result===============")
   func = mx.nd.CachedOp(ret)
   Imperative invoke result==============
   <NDArray  @cpu(0)>
   Symbol bind result===============
   <NDArray  @cpu(0)>
   CachedOp result===============
   <NDArray  @cpu(0)>
   @junrushao1994 @szha @eric-haibin-lin @zheng-da @yzhliu

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:

With regards,
Apache Git Services

View raw message