From 6f77f29660aa1c0c3a13f87dfc07eda00d0d07e7 Mon Sep 17 00:00:00 2001 From: Roshani Nagmote Date: Tue, 13 Nov 2018 16:56:13 -0800 Subject: [PATCH] Doc fixes --- src/operator/contrib/index_copy.cc | 36 +++++++++++++++------------- src/operator/contrib/quadratic_op.cc | 6 ++++- src/operator/contrib/roi_align.cc | 4 ++-- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/operator/contrib/index_copy.cc b/src/operator/contrib/index_copy.cc index 316c8a7187fb..70a32a1b2d99 100644 --- a/src/operator/contrib/index_copy.cc +++ b/src/operator/contrib/index_copy.cc @@ -37,30 +37,32 @@ static bool IndexCopyType(const nnvm::NodeAttrs& attrs, } NNVM_REGISTER_OP(_contrib_index_copy) -.describe(R"code(Copies the elements of a `new_tensor` into the `old_tensor` by -selecting the indices in the order given in `index`. The output will be a new tensor -contains the rest elements of old tensor and the copied elements of new tensor. -For example, if `index[i] == j`, then the `i`th row of `new_tensor` is copied to the -`j`th row of output. +.describe(R"code(Copies the elements of a `new_tensor` into the `old_tensor`. -The `index` must be a vector and it must have the same size with the `0`th dimimention of -`new_tensor`. Also, the `0`th dimimention of old_tensor must `>=` the `0`th dimimention of +This operator copies the elements by selecting the indices in the order given in `index`. +The output will be a new tensor containing the rest elements of old tensor and +the copied elements of new tensor. +For example, if `index[i] == j`, then the `i` th row of `new_tensor` is copied to the +`j` th row of output. + +The `index` must be a vector and it must have the same size with the `0` th dimension of +`new_tensor`. Also, the `0` th dimension of old_tensor must `>=` the `0` th dimension of `new_tensor`, or an error will be raised. Examples:: -x = mx.nd.zeros((5,3)) -t = mx.nd.array([[1,2,3],[4,5,6],[7,8,9]]) -index = mx.nd.array([0,4,2]) + x = mx.nd.zeros((5,3)) + t = mx.nd.array([[1,2,3],[4,5,6],[7,8,9]]) + index = mx.nd.array([0,4,2]) -mx.nd.contrib.index_copy(x, index, t) + mx.nd.contrib.index_copy(x, index, t) -[[1. 2. 3.] - [0. 0. 0.] - [7. 8. 9.] - [0. 0. 0.] - [4. 5. 6.]] - + [[1. 2. 3.] + [0. 0. 0.] + [7. 8. 9.] + [0. 0. 0.] + [4. 5. 6.]] + )code" ADD_FILELINE) .set_num_inputs(3) diff --git a/src/operator/contrib/quadratic_op.cc b/src/operator/contrib/quadratic_op.cc index d8b2d785c79e..043379e44074 100644 --- a/src/operator/contrib/quadratic_op.cc +++ b/src/operator/contrib/quadratic_op.cc @@ -29,12 +29,16 @@ namespace op { DMLC_REGISTER_PARAMETER(QuadraticParam); NNVM_REGISTER_OP(_contrib_quadratic) -.describe(R"code(This operators implements the quadratic function: +.describe(R"code(This operators implements the quadratic function. + .. math:: f(x) = ax^2+bx+c + where :math:`x` is an input tensor and all operations in the function are element-wise. + Example:: + x = [[1, 2], [3, 4]] y = quadratic(data=x, a=1, b=2, c=3) y = [[6, 11], [18, 27]] diff --git a/src/operator/contrib/roi_align.cc b/src/operator/contrib/roi_align.cc index 3ce2213d739f..76675677fa08 100644 --- a/src/operator/contrib/roi_align.cc +++ b/src/operator/contrib/roi_align.cc @@ -515,8 +515,8 @@ input features at four regularly sampled locations in each RoI bin. Then the feature map can be aggregated by avgpooling. -Reference ---------- +References +---------- He, Kaiming, et al. "Mask R-CNN." ICCV, 2017 )code" ADD_FILELINE)