You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2018/08/22 21:42:38 UTC
[incubator-mxnet] branch master updated: [MXNET-696] Fix undefined
name and enable Pylint undefined variable (#12277)
This is an automated email from the ASF dual-hosted git repository.
zhasheng 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 76bdc87 [MXNET-696] Fix undefined name and enable Pylint undefined variable (#12277)
76bdc87 is described below
commit 76bdc8772c7f4edd3087bd1285025122fc837c06
Author: Vandana Kannan <va...@users.noreply.github.com>
AuthorDate: Wed Aug 22 14:42:29 2018 -0700
[MXNET-696] Fix undefined name and enable Pylint undefined variable (#12277)
* Fix infinite loop in retain
* Enable undefined variable in pylint
---
ci/other/pylintrc | 1 -
python/mxnet/ndarray/sparse.py | 8 +++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/ci/other/pylintrc b/ci/other/pylintrc
index ca31417..db3da4c 100644
--- a/ci/other/pylintrc
+++ b/ci/other/pylintrc
@@ -101,7 +101,6 @@ disable=
import-error,
unsubscriptable-object,
unbalanced-tuple-unpacking,
- undefined-variable,
protected-access,
superfluous-parens,
invalid-name,
diff --git a/python/mxnet/ndarray/sparse.py b/python/mxnet/ndarray/sparse.py
index 88f5eae..7b4cc90 100644
--- a/python/mxnet/ndarray/sparse.py
+++ b/python/mxnet/ndarray/sparse.py
@@ -46,9 +46,9 @@ from ..context import Context, current_context
from . import _internal
from . import op
try:
- from .gen_sparse import * # pylint: disable=redefined-builtin
+ from .gen_sparse import retain as gs_retain # pylint: disable=redefined-builtin
except ImportError:
- pass
+ gs_retain = None
from ._internal import _set_ndarray_class
from .ndarray import NDArray, _storage_type, _DTYPE_NP_TO_MX, _DTYPE_MX_TO_NP
from .ndarray import _STORAGE_TYPE_STR_TO_ID, _STORAGE_TYPE_ROW_SPARSE, _STORAGE_TYPE_CSR
@@ -787,7 +787,9 @@ class RowSparseNDArray(BaseSparseNDArray):
The arguments are the same as for :py:func:`retain`, with
this array as data.
"""
- return retain(self, *args, **kwargs)
+ if not gs_retain:
+ raise ImportError("gen_sparse could not be imported")
+ return gs_retain(*args, **kwargs)
def _prepare_src_array(source_array, dtype):
"""Prepare `source_array` so that it can be used to construct NDArray.