This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Add Index to IO Batch #504
Merged
Merged
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
f71f1b1
add enable image index
0bbff0c
add index
97b3d09
fix lint
d8cb825
add enable image index
278dfad
add index
9505323
fix lint
edd9b9c
change c_api index interface
b3249d4
Merge branch 'master' of https://github.com/junranhe/mxnet
07a0de7
fix lint
f8187a6
fix coredown
33b0d03
fix bug with inst_index is null
652e3b2
fix io index
9d1abbf
Merge pull request #519 from starimpact/master
tqchen a059d6a
checkout Makefile
503443f
add enable image index
775d97b
add index
72d21ad
fix lint
120cf4b
add enable image index
7df73de
add index
318ca2a
fix lint
c17affd
change c_api index interface
baf3684
fix lint
909ca3e
fix coredown
2fc16a3
fix bug with inst_index is null
04a9a79
fix io index
6492418
Merge branch 'master' of https://github.com/junranhe/mxnet
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule ps-lite
updated
15 files
+0 −1 | .gitignore | |
+2 −2 | .travis.yml | |
+0 −54 | CMakeLists.txt | |
+1 −1 | Makefile | |
+0 −62 | cmake/External/zmq.cmake | |
+0 −17 | cmake/Modules/FindZMQ.cmake | |
+0 −86 | cmake/ProtoBuf.cmake | |
+1 −4 | include/ps/internal/postoffice.h | |
+2 −1 | include/ps/kv_app.h | |
+0 −3 | make/travis/travis_before_cache.sh | |
+0 −10 | make/travis/travis_script.sh | |
+0 −12 | make/travis/travis_setup_env.sh | |
+4 −10 | src/postoffice.cc | |
+3 −183 | src/van.cc | |
+0 −45 | src/windows/unistd.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,12 +62,12 @@ class PrefetcherIter : public IIterator<DataBatch> { | |
iter_.Init([this](DataBatch **dptr) { | ||
if (!loader_->Next()) return false; | ||
const TBlobBatch& batch = loader_->Value(); | ||
|
||
if (*dptr == nullptr) { | ||
// allocate databatch | ||
*dptr = new DataBatch(); | ||
(*dptr)->num_batch_padd = batch.num_batch_padd; | ||
(*dptr)->data.resize(batch.data.size()); | ||
(*dptr)->index.resize(batch.batch_size); | ||
for (size_t i = 0; i < batch.data.size(); ++i) { | ||
(*dptr)->data.at(i) = NDArray(batch.data[i].shape_, Context::CPU()); | ||
} | ||
|
@@ -80,6 +80,9 @@ class PrefetcherIter : public IIterator<DataBatch> { | |
batch.data[i].FlatTo2D<cpu, real_t>()); | ||
(*dptr)->num_batch_padd = batch.num_batch_padd; | ||
} | ||
for (size_t i = 0; i < batch.batch_size; ++i) { | ||
(*dptr)->index[i] = batch.inst_index[i]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use std::copy |
||
} | ||
return true; | ||
}, | ||
[this]() { loader_->BeforeFirst(); }); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to return in one function,