diff --git a/python/mxnet/ndarray/mkldnn.py b/python/mxnet/ndarray/mkldnn.py deleted file mode 100644 index 85544266015f..000000000000 --- a/python/mxnet/ndarray/mkldnn.py +++ /dev/null @@ -1,87 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# coding: utf-8 -# pylint: disable=wildcard-import, unused-wildcard-import, too-many-lines - -"""MKLDNN NDArray API of MXNet.""" - -from __future__ import absolute_import -from __future__ import division - -import warnings - -__all__ = ["MKLNDArray"] - -from ..context import Context -from . import _internal -from . import op -from .ndarray import NDArray -from .sparse import _ndarray_cls - -class MKLNDArray(NDArray): - """The base class of an NDArray stored in a MKLDNN storage format. - """ - - def _at(self, idx): - raise NotSupportedForMKLNDArray(self._at, '[idx]', idx) - - def _slice(self, start, stop): - return op.slice(self, begin=start, end=stop) - - def astype(self, dtype): - """Returns a copy of the array after casting to a specified type. - Parameters - ---------- - dtype : numpy.dtype or str - The type of the returned array. - Examples - -------- - >>> x = mx.nd.sparse.zeros('row_sparse', (2,3), dtype='float32') - >>> y = x.astype('int32') - >>> y.dtype - - """ - res = zeros(shape=self.shape, ctx=self.context, - dtype=dtype, stype=self.stype) - self.copyto(res) - return res - - def copyto(self, other): - """Copies the value of this array to another array. - - Parameters - ---------- - other : NDArray or CSRNDArray or RowSparseNDArray or Context - The destination array or context. - - Returns - ------- - NDArray or CSRNDArray or RowSparseNDArray - The copied array. - """ - if isinstance(other, NDArray): - if other.handle is self.handle: - warnings.warn('You are attempting to copy an array to itself', RuntimeWarning) - return - return _internal._copyto(self, out=other) - elif isinstance(other, Context): - hret = _ndarray_cls(_new_alloc_handle(self.stype, self.shape, other, - True, self.dtype, self._aux_types)) - return _internal._copyto(self, out=hret) - else: - raise TypeError('copyto does not support type ' + str(type(other))) diff --git a/python/mxnet/ndarray/ndarray.py b/python/mxnet/ndarray/ndarray.py index 885048e3ae91..a45a6a82471e 100644 --- a/python/mxnet/ndarray/ndarray.py +++ b/python/mxnet/ndarray/ndarray.py @@ -52,7 +52,6 @@ _STORAGE_TYPE_DEFAULT = 0 _STORAGE_TYPE_ROW_SPARSE = 1 _STORAGE_TYPE_CSR = 2 -_STORAGE_TYPE_MKLDNN = 3 # pylint: disable= no-member _DTYPE_NP_TO_MX = { diff --git a/python/mxnet/ndarray/sparse.py b/python/mxnet/ndarray/sparse.py index e29d3da9b476..700dee0b07fa 100644 --- a/python/mxnet/ndarray/sparse.py +++ b/python/mxnet/ndarray/sparse.py @@ -50,7 +50,6 @@ 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 -from .ndarray import _STORAGE_TYPE_MKLDNN from .ndarray import _STORAGE_TYPE_UNDEFINED, _STORAGE_TYPE_DEFAULT from .ndarray import zeros as _zeros_ndarray from .ndarray import array as _array @@ -1139,8 +1138,6 @@ def _ndarray_cls(handle, writable=True, stype=_STORAGE_TYPE_UNDEFINED): stype = _storage_type(handle) if stype == _STORAGE_TYPE_DEFAULT: return NDArray(handle, writable=writable) - elif stype == _STORAGE_TYPE_MKLDNN: - return NDArray(handle, writable=writable) elif stype == _STORAGE_TYPE_CSR: return CSRNDArray(handle, writable=writable) elif stype == _STORAGE_TYPE_ROW_SPARSE: