Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Formatting fixes #6433

Merged
merged 4 commits into from
May 25, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions python/mxnet/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def fixed_crop(src, x0, y0, w, h, size=None, interp=2):

def random_crop(src, size, interp=2):
"""Randomly crop `src` with `size` (width, height).
Upsample result if `src` is smaller than `size`.
Upsample result if `src` is smaller than `size`.

Parameters
----------
Expand Down Expand Up @@ -239,7 +239,7 @@ def center_crop(src, size, interp=2):

4: Lanczos interpolation over 8x8 pixel neighborhood.

When shrinking an image, it will generally look best with AREA-based
When shrinking an image, it will generally look best with AREA-based
interpolation, whereas, when enlarging an image, it will generally look best
with Bicubic (slow) or Bilinear (faster but still looks OK).

Expand Down Expand Up @@ -708,7 +708,6 @@ def read_image(self, fname):
Example usage:
----------
>>> dataIter.read_image('Face.jpg') # returns decoded raw bytes.
'\xff\xd8\xff\xe0\x00...'
"""
with open(os.path.join(self.path_root, fname), 'rb') as fin:
img = fin.read()
Expand Down
2 changes: 1 addition & 1 deletion python/mxnet/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DataDesc(namedtuple('DataDesc', ['name', 'shape'])):
that the first axis is number of examples in the batch(N),
C is number of channels, H is the height and W is the width of the image.

for sequential data, by default `layout` is set to ``NTC`` where
For sequential data, by default `layout` is set to ``NTC``, where
N is number of examples in the batch, T the temporal axis representing time
and C is the number of channels.

Expand Down
16 changes: 8 additions & 8 deletions python/mxnet/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Symbol(SymbolBase):
__slots__ = []

def __repr__(self):
"""Get a string representation of the symbol."""
"""Gets a string representation of the symbol."""
name = self.name
if name is None:
name = ', '.join([i.name for i in self])
Expand Down Expand Up @@ -453,7 +453,7 @@ def __getitem__(self, index):

@property
def name(self):
"""Get name string from the symbol, this function only works for non-grouped symbol.
"""Gets name string from the symbol, this function only works for non-grouped symbol.

Returns
-------
Expand Down Expand Up @@ -1412,7 +1412,7 @@ def bind(self, ctx, args, args_grad=None, grad_req='write',
return executor

def grad(self, wrt):
"""Get the autodiff of current symbol.
"""Gets the autodiff of current symbol.

This function can only be used if current symbol is a loss function.

Expand Down Expand Up @@ -1793,9 +1793,9 @@ def minimum(left, right):
# pylint: disable=no-member
# pylint: disable=redefined-builtin
def hypot(left, right):
"""Given the "legs" of a right triangle, return its hypotenuse.
"""Given the "legs" of a right triangle, returns its hypotenuse.

Equivalent to "sqrt(left**2 + right**2)", element-wise.
Equivalent to :math:`\sqrt(left^2 + right^2)`, element-wise.
Both inputs can be Symbol or scalar number. Broadcasting is not supported.

Parameters
Expand Down Expand Up @@ -1836,7 +1836,7 @@ def hypot(left, right):


def zeros(shape, dtype=None, **kwargs):
"""Return a new symbol of given shape and type, filled with zeros.
"""Returns a new symbol of given shape and type, filled with zeros.

Parameters
----------
Expand All @@ -1856,7 +1856,7 @@ def zeros(shape, dtype=None, **kwargs):


def ones(shape, dtype=None, **kwargs):
"""Return a new symbol of given shape and type, filled with ones.
"""Returns a new symbol of given shape and type, filled with ones.

Parameters
----------
Expand All @@ -1876,7 +1876,7 @@ def ones(shape, dtype=None, **kwargs):


def arange(start, stop=None, step=1.0, repeat=1, name=None, dtype=None):
"""Return evenly spaced values within a given interval.
"""Returns evenly spaced values within a given interval.

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion src/operator/concat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ MXNET_REGISTER_OP_PROPERTY(Concat, ConcatProp)
.. note:: `Concat` is deprecated. Use `concat` instead.

The dimensions of the input arrays should be the same except the axis along
which they will concatenated.
which they will concatenated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be concatenated

The dimension of the output array along the concatenated axis will be equal
to the sum of the corresponding dimensions of the input arrays.

Expand Down
2 changes: 1 addition & 1 deletion src/operator/loss_binary_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ NNVM_REGISTER_OP(softmax_cross_entropy)

.. math:: \text{CE(label, output)} = - \sum_i \text{label}_i \log(\text{output}_i)

Example::
Example::

x = [[1, 2, 3],
[11, 7, 5]]
Expand Down
2 changes: 2 additions & 0 deletions src/operator/slice_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ Example::
along the `axis` which it is split.
Also `squeeze_axis` can be set to true only if ``input.shape[axis] == num_outputs``.

Example::

z = split(x, axis=0, num_outputs=3, squeeze_axis=1) // a list of 3 arrays with shape (2, 1)
z = [[ 1.]
[ 2.]]
Expand Down
2 changes: 1 addition & 1 deletion src/operator/softmax_output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ MXNET_REGISTER_OP_PROPERTY(SoftmaxOutput, SoftmaxOutputProp)

- If the parameter `use_ignore` is ``true``, `ignore_label` can specify input instances
with a particular label to be ignored during backward propagation. **This has no effect when
softmax** `output` **has same shape as** `label`.
softmax `output` has same shape as `label`**.

Example::

Expand Down
2 changes: 1 addition & 1 deletion src/operator/tensor/indexing_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ The locations represented by `indices` take value `on_value`, while all
other locations take value `off_value`.

`one_hot` operation with `indices` of shape ``(i0, i1)`` and `depth` of ``d`` would result
in an output array of shape ``(i0, i1, d)`` with::
in an output array of shape ``(i0, i1, d)`` with::

output[i,j,:] = off_value
output[i,j,indices[i,j]] = on_value
Expand Down
2 changes: 1 addition & 1 deletion src/operator/tensor/matrix_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ and ``end=(e_1, e_2, ... e_n)`` indices will result in an array with the shape
``(e_1-b_0, ..., e_n-b_n-1)``.

The resulting array's *k*-th dimension contains elements
from the *k*-th dimension of the input array with the open range ``[b_k, e_k)``.
from the *k*-th dimension of the input array with the open range ``[b_k, e_k)``.

Example::

Expand Down
73 changes: 45 additions & 28 deletions src/operator/tensor/multisample_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ DMLC_REGISTER_PARAMETER(MultiSampleParam);
inline std::string uniform_desc() {
return std::string(R"code(Concurrent sampling from multiple
uniform distributions on the intervals given by *[low,high)*.

The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*. For any
valid *n*-dimensional index *i* with respect to the input arrays, *output[i]* will be
an *m*-dimensional array that holds randomly drawn samples from the distribution which
is parameterized by the input values at index *i*. If the shape parameter of the
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.

For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.

Expand All @@ -182,13 +184,15 @@ Examples::
inline std::string normal_desc() {
return std::string(R"code(Concurrent sampling from multiple
normal distributions with parameters *mu* (mean) and *sigma* (standard deviation).

The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*. For any
valid *n*-dimensional index *i* with respect to the input arrays, *output[i]* will be
an *m*-dimensional array that holds randomly drawn samples from the distribution which
is parameterized by the input values at index *i*. If the shape parameter of the
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.

For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.

Expand All @@ -209,13 +213,15 @@ Examples::
inline std::string gamma_desc() {
return std::string(R"code(Concurrent sampling from multiple
gamma distributions with parameters *alpha* (shape) and *beta* (scale).

The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*. For any
valid *n*-dimensional index *i* with respect to the input arrays, *output[i]* will be
an *m*-dimensional array that holds randomly drawn samples from the distribution which
is parameterized by the input values at index *i*. If the shape parameter of the
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.

For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.

Expand All @@ -236,13 +242,15 @@ Examples::
inline std::string exponential_desc() {
return std::string(R"code(Concurrent sampling from multiple
exponential distributions with parameters lambda (rate).

The parameters of the distributions are provided as an input array.
Let *[s]* be the shape of the input array, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*. For any
valid *n*-dimensional index *i* with respect to the input array, *output[i]* will be
an *m*-dimensional array that holds randomly drawn samples from the distribution which
is parameterized by the input value at index *i*. If the shape parameter of the
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.

For any valid *n*-dimensional index *i* with respect to the input array, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input value at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input array.

Expand All @@ -262,15 +270,18 @@ Examples::
inline std::string poisson_desc() {
return std::string(R"code(Concurrent sampling from multiple
Poisson distributions with parameters lambda (rate).

The parameters of the distributions are provided as an input array.
Let *[s]* be the shape of the input array, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*. For any
valid *n*-dimensional index *i* with respect to the input array, *output[i]* will be
an *m*-dimensional array that holds randomly drawn samples from the distribution which
is parameterized by the input value at index *i*. If the shape parameter of the
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.

For any valid *n*-dimensional index *i* with respect to the input array, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input value at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input array.

Samples will always be returned as a floating point data type.

Examples::
Expand All @@ -289,15 +300,18 @@ Examples::
inline std::string negative_binomial_desc() {
return std::string(R"code(Concurrent sampling from multiple
negative binomial distributions with parameters *k* (failure limit) and *p* (failure probability).

The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*. For any
valid *n*-dimensional index *i* with respect to the input arrays, *output[i]* will be
an *m*-dimensional array that holds randomly drawn samples from the distribution which
is parameterized by the input values at index *i*. If the shape parameter of the
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.

For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.

Samples will always be returned as a floating point data type.

Examples::
Expand All @@ -317,15 +331,18 @@ Examples::
inline std::string generalized_negative_binomial_desc() {
return std::string(R"code(Concurrent sampling from multiple
generalized negative binomial distributions with parameters *mu* (mean) and *alpha* (dispersion).

The parameters of the distributions are provided as input arrays.
Let *[s]* be the shape of the input arrays, *n* be the dimension of *[s]*, *[t]*
be the shape specified as the parameter of the operator, and *m* be the dimension
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*. For any
valid *n*-dimensional index *i* with respect to the input arrays, *output[i]* will be
an *m*-dimensional array that holds randomly drawn samples from the distribution which
is parameterized by the input values at index *i*. If the shape parameter of the
of *[t]*. Then the output will be a *(n+m)*-dimensional array with shape *[s]x[t]*.

For any valid *n*-dimensional index *i* with respect to the input arrays, *output[i]*
will be an *m*-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index *i*. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.

Samples will always be returned as a floating point data type.

Examples::
Expand Down
2 changes: 1 addition & 1 deletion src/operator/upsampling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Operator* UpSamplingProp::CreateOperatorEx(Context ctx, std::vector<TShape> *in_
DMLC_REGISTER_PARAMETER(UpSamplingParam);

MXNET_REGISTER_OP_PROPERTY(UpSampling, UpSamplingProp)
.describe("Performs nearest neighbor/bilinear up sampling to inputs")
.describe("Performs nearest neighbor/bilinear up sampling to inputs.")
.add_argument("data", "NDArray-or-Symbol[]", "Array of tensors to upsample")
.add_arguments(UpSamplingParam::__FIELDS__())
.set_key_var_num_args("num_args");
Expand Down