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

Commit

Permalink
Merge remote-tracking branch 'origin/master' into mkldnn-v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TaoLv committed Oct 17, 2019
2 parents b5cdabe + c2bbde7 commit ba3229b
Show file tree
Hide file tree
Showing 54 changed files with 4,468 additions and 696 deletions.
1 change: 1 addition & 0 deletions ci/docker/Dockerfile.build.ubuntu_nightly_gpu
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ COPY install/deb_ubuntu_ccache.sh /work/
RUN /work/deb_ubuntu_ccache.sh

COPY install/ubuntu_python.sh /work/
COPY install/requirements /work/
RUN /work/ubuntu_python.sh

COPY install/ubuntu_scala.sh /work/
Expand Down
7 changes: 5 additions & 2 deletions ci/other/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ persistent=yes
load-plugins=

# Use multiple processes to speed up Pylint.
jobs=8
jobs=1

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
Expand Down Expand Up @@ -113,7 +113,10 @@ disable=
too-many-instance-attributes,
too-many-locals,
too-many-public-methods,
too-many-statements
too-many-statements,
too-many-lines,
duplicate-code,
cyclic-import

# disable=unicode-builtin,delslice-method,using-cmp-argument,setslice-method,dict-view-method,parameter-unpacking,range-builtin-not-iterating,print-statement,file-builtin,old-raise-syntax,basestring-builtin,execfile-builtin,indexing-exception,import-star-module-level,coerce-method,long-builtin,old-ne-operator,old-division,no-absolute-import,raw_input-builtin,old-octal-literal,oct-method,xrange-builtin,hex-method,unpacking-in-except,nonzero-method,raising-string,intern-builtin,reload-builtin,metaclass-assignment,cmp-method,filter-builtin-not-iterating,apply-builtin,map-builtin-not-iterating,next-method-called,unichr-builtin,buffer-builtin,dict-iter-method,input-builtin,coerce-builtin,getslice-method,useless-suppression,standarderror-builtin,zip-builtin-not-iterating,suppressed-message,cmp-builtin,backtick,long-suffix,reduce-builtin,round-builtin

Expand Down
34 changes: 18 additions & 16 deletions docs/python_docs/_static/autodoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,32 @@
/* Customizations to the Sphinx auto module plugin output */
function auto_index() {
var targets = $("dl.class>dt,dl.function>dt");

var li_node = $("li.current>span>a.current.reference.internal").parent().parent();
var html = "<ul id='autodoc'>";
if (li_node.length > 0) {
for (var i = 0; i < targets.length; ++i) {
var id = $(targets[i]).attr('id');
if (id) {
var paths = id.split('.')
if (paths.length >= 2) {
var id_simple = paths.pop();
id_simple = paths.pop() + "." + id_simple;
} else {
var id_simple = id;
if (targets.length > 0) {
for (var i = 0; i < targets.length; ++i) {
var id = $(targets[i]).attr('id');
if (id) {
var paths = id.split('.')
if (paths.length >= 2) {
var id_simple = paths.pop();
id_simple = paths.pop() + "." + id_simple;
} else {
var id_simple = id;
}
html += "<li><span class='link-wrapper'><a class='reference internal' href='#";
html += id;
html += "'>" + id_simple + "</a></span</li>";
}
html += "<li><span class='link-wrapper'><a class='reference internal' href='#";
html += id;
html += "'>" + id_simple + "</a></span</li>";
}
html += "</ul>";
li_node.append(html);
li_node.prepend("<a><span id='autodoc_toggle' onclick='$(\"#autodoc\").toggle()'>[toggle]</span></a>")
}
html += "</ul>";
li_node.append(html);
li_node.prepend("<a><span id='autodoc_toggle' onclick='$(\"#autodoc\").toggle()'>[toggle]</span></a>")
} else {
setTimeout(auto_index, 500);
}

}
$(document).ready(auto_index);
6 changes: 3 additions & 3 deletions docs/static_site/src/_includes/get_started/get_started.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
/** Defaults **/
/** See options.js for the full ugly script **/
var versionSelect = defaultVersion = 'v1.5.0';
var versionSelect = defaultVersion = 'v1.5.1';
var platformSelect = 'linux';
var languageSelect = 'python';
var processorSelect = 'cpu';
Expand All @@ -21,10 +21,10 @@ <h2>Installing MXNet</h2>
</div>
<div class="col-9 install-right">
<div class="dropdown">
<button class="current-version dropbtn btn" type="button" data-toggle="dropdown">v1.5.0</button>
<button class="current-version dropbtn btn" type="button" data-toggle="dropdown">v1.5.1</button>
<ul class="opt-group dropdown-content">
<li class="opt versions"><a href="#">master</a></li>
<li class="opt active versions"><a href="#">v1.5.0</a></li>
<li class="opt active versions"><a href="#">v1.5.1</a></li>
<li class="opt versions"><a href="#">v1.4.1</a></li>
<li class="opt versions"><a href="#">v1.3.1</a></li>
<li class="opt versions"><a href="#">v1.2.1</a></li>
Expand Down
2 changes: 1 addition & 1 deletion docs/static_site/src/_includes/get_started/pip_snippet.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Check the chart below for other options, refer to <a href="https://pypi.org/proj
other MXNet pip packages</a>, or <a href="get_started/validate_mxnet.html">validate your MXNet installation</a>.

<div style="text-align: center">
<img src="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/install/pip-packages.png"
<img src="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/install/pip-packages-1.5.1.png"
alt="pip packages"/>
</div>

Expand Down
1 change: 1 addition & 0 deletions docs/static_site/src/pages/get_started/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ These source archives are generated from tagged releases. Updates and patches wi

| Version | Source | PGP | SHA |
|---------|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| 1.5.1 | [Download](https://apache.org/dist/incubator/mxnet/1.5.1/apache-mxnet-src-1.5.1-incubating.tar.gz) | [Download](https://apache.org/dist/incubator/mxnet/1.5.1/apache-mxnet-src-1.5.1-incubating.tar.gz.asc) | [Download](https://apache.org/dist/incubator/mxnet/1.5.1/apache-mxnet-src-1.5.1-incubating.tar.gz.sha512) |
| 1.5.0 | [Download](https://apache.org/dist/incubator/mxnet/1.5.0/apache-mxnet-src-1.5.0-incubating.tar.gz) | [Download](https://apache.org/dist/incubator/mxnet/1.5.0/apache-mxnet-src-1.5.0-incubating.tar.gz.asc) | [Download](https://apache.org/dist/incubator/mxnet/1.5.0/apache-mxnet-src-1.5.0-incubating.tar.gz.sha512) |
| 1.4.1 | [Download](https://www.apache.org/dyn/closer.cgi/incubator/mxnet/1.4.1/apache-mxnet-src-1.4.1-incubating.tar.gz) | [Download](https://apache.org/dist/incubator/mxnet/1.4.1/apache-mxnet-src-1.4.1-incubating.tar.gz.asc) | [Download](https://apache.org/dist/incubator/mxnet/1.4.1/apache-mxnet-src-1.4.1-incubating.tar.gz.sha512) |
| 1.4.0 | [Download](https://www.apache.org/dyn/closer.cgi/incubator/mxnet/1.4.0/apache-mxnet-src-1.4.0-incubating.tar.gz) | [Download](https://apache.org/dist/incubator/mxnet/1.4.0/apache-mxnet-src-1.4.0-incubating.tar.gz.asc) | [Download](https://apache.org/dist/incubator/mxnet/1.4.0/apache-mxnet-src-1.4.0-incubating.tar.gz.sha512) |
Expand Down
44 changes: 44 additions & 0 deletions python/mxnet/_numpy_op_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,47 @@ def _np_squeeze(a, axis=None, out=None):
(1, 3)
"""
pass


def _np_moveaxis(a, source, destination):
"""Move axes of an array to new positions.
Other axes remain in their original order.
Parameters
----------
a : ndarray
The array whose axes should be reordered.
source : int or sequence of int
Original positions of the axes to move. These must be unique.
destination : int or sequence of int
Destination positions for each of the original axes. These must also be
unique.
Returns
-------
result : ndarray
Array with moved axes. This array is a view of the input array.
See Also
--------
transpose: Permute the dimensions of an array.
swapaxes: Interchange two axes of an array.
Examples
--------
>>> x = np.zeros((3, 4, 5))
>>> np.moveaxis(x, 0, -1).shape
(4, 5, 3)
>>> np.moveaxis(x, -1, 0).shape
(5, 3, 4)
These all achieve the same result:
>>> np.transpose(x).shape
(5, 4, 3)
>>> np.swapaxes(x, 0, -1).shape
(5, 4, 3)
>>> np.moveaxis(x, [0, 1], [-1, -2]).shape
(5, 4, 3)
>>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape
(5, 4, 3)
"""
pass
21 changes: 18 additions & 3 deletions python/mxnet/gluon/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
'ParameterDict', 'tensor_types']


from collections import OrderedDict
from collections import OrderedDict, defaultdict
import warnings
import numpy as np
import mxnet as mx

from ..base import mx_real_t, MXNetError
from .. import symbol, ndarray, initializer, context
Expand Down Expand Up @@ -887,8 +888,22 @@ def initialize(self, init=initializer.Uniform(), ctx=None, verbose=False,

def zero_grad(self):
"""Sets all Parameters' gradient buffer to 0."""
for i in self.values():
i.zero_grad()
# collect gradient arrays for each ctx
arrays = defaultdict(list)
for p in self.values():
if p.grad_req == 'null' or p._grad is None:
continue
for g in p.list_grad():
if g.stype == 'row_sparse':
mx.ndarray.zeros_like(g, out=g)
else:
arrays[g.context].append(g)

if len(arrays) == 0:
return

for arr in arrays.values():
mx.nd.reset_arrays(*arr, num_arrays=len(arr))

def reset_ctx(self, ctx):
"""Re-assign all Parameters to other contexts.
Expand Down
Loading

0 comments on commit ba3229b

Please sign in to comment.