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

Use a big ndarray in gluon/data/vision #7661

Merged
merged 1 commit into from
Sep 2, 2017
Merged

Use a big ndarray in gluon/data/vision #7661

merged 1 commit into from
Sep 2, 2017

Conversation

mli
Copy link
Member

@mli mli commented Aug 30, 2017

use nd.array(data) instead of a list of ndarray to accelerate the time

use `nd.array(data)` instead of a list of ndarray to accelerate the time
@piiswrong
Copy link
Contributor

Is it actually faster? This way slicing happens at runtime

@mli
Copy link
Member Author

mli commented Sep 2, 2017

reduce loading time from 7s to 2s. i guest the overhead is list and creating a large number of ndarrray

@piiswrong piiswrong merged commit 5b5723b into master Sep 2, 2017
@@ -105,7 +105,7 @@ def _get_data(self):
data = np.fromstring(fin.read(), dtype=np.uint8)
data = data.reshape(len(label), 28, 28, 1)

self._data = [nd.array(x, dtype=x.dtype) for x in data]
self._data = nd.array(data)
Copy link
Contributor

Choose a reason for hiding this comment

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

does this also need a dtype?

@mli mli mentioned this pull request Sep 2, 2017
mbaijal pushed a commit to mbaijal/incubator-mxnet that referenced this pull request Sep 6, 2017
use `nd.array(data)` instead of a list of ndarray to accelerate the time
cjolivier01 pushed a commit to cjolivier01/mxnet that referenced this pull request Sep 11, 2017
use `nd.array(data)` instead of a list of ndarray to accelerate the time
crazy-cat pushed a commit to crazy-cat/incubator-mxnet that referenced this pull request Oct 26, 2017
use `nd.array(data)` instead of a list of ndarray to accelerate the time
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants