This is an automated email from the ASF dual-hosted git repository. haibin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push: new b30fba6 Fixing the doc for symbolic version of rand_zipfian (#13978) b30fba6 is described below commit b30fba6ddbb704273edbf93a978e0863130ec941 Author: Sina Afrooze <sina....@gmail.com> AuthorDate: Thu Jan 24 10:45:20 2019 -0800 Fixing the doc for symbolic version of rand_zipfian (#13978) * Fixes #12779 --- python/mxnet/symbol/contrib.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/python/mxnet/symbol/contrib.py b/python/mxnet/symbol/contrib.py index d54267f..a83227a 100644 --- a/python/mxnet/symbol/contrib.py +++ b/python/mxnet/symbol/contrib.py @@ -73,17 +73,14 @@ def rand_zipfian(true_classes, num_sampled, range_max): Examples -------- - >>> true_cls = mx.nd.array([3]) - >>> samples, exp_count_true, exp_count_sample = mx.nd.contrib.rand_zipfian(true_cls, 4, 5) - >>> samples - [1 3 3 3] - <NDArray 4 @cpu(0)> - >>> exp_count_true - [ 0.12453879] - <NDArray 1 @cpu(0)> - >>> exp_count_sample - [ 0.22629439 0.12453879 0.12453879 0.12453879] - <NDArray 4 @cpu(0)> + >>> true_cls = mx.sym.Variable('true_cls') + >>> samples, exp_count_true, exp_count_sample = mx.sym.contrib.rand_zipfian(true_cls, 4, 5) + >>> samples.eval(true_cls=mx.nd.array([3]))[0].asnumpy() + array([1, 3, 3, 3]) + >>> exp_count_true.eval(true_cls=mx.nd.array([3]))[0].asnumpy() + array([0.12453879]) + >>> exp_count_sample.eval(true_cls=mx.nd.array([3]))[0].asnumpy() + array([0.22629439, 0.12453879, 0.12453879, 0.12453879]) """ assert(isinstance(true_classes, Symbol)), "unexpected type %s" % type(true_classes) log_range = math.log(range_max + 1)