-
Notifications
You must be signed in to change notification settings - Fork 688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow indexer to attach specific manager #1688
allow indexer to attach specific manager #1688
Conversation
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.
This is a good change @patins1!
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
public class ManagerAttachmentTest { |
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.
Instead of creating these tests for both MXNet engine and PyTorch engine, can you move it into the integration module? That is where we put the tests representing behavior shared for the entire engine spec. Engines that don't fully implement the spec can return an UnsupportedOperationException and it will not be considered failing the test
* @param index the section of this {@code NDArray} to return | ||
* @return the partial {@code NDArray} | ||
*/ | ||
default NDArray get(NDIndex index, NDManager manager) { |
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.
Minor thing, but I feel like it would be more consistent to put manager as the first argument
1. moved MXNet and PyTorch unit test into integration test module 2. Fix TensorFlow tempAttach issue Change-Id: I213b34caf51679a5ae7d955414c4bc5c4db91c1a
Change-Id: Iaca16533bfdb7611a4d68d574b5a7fa884280bc0
Rectifications look great @zachgk @frankfliu |
This feature allows to pass an NDManager to NDArray indexation operation so that the result is attached to the passed NDManager instead of to the original NDManager of the NDArray.
Thus, ArrayDataset.get() does not need to attach the result of the indexation a second time, thus batch creation is speeded up.
In my performance tests, I got following improvement:
Before:
It took 6872ms totally
It took 6876ms totally
It took 6825ms totally
It took 6923ms totally
After:
It took 6734ms totally
It took 6709ms totally
It took 6728ms totally
It took 6703ms totally
So the training time is reduced by 2.2% !
Also, this pull request fixes a bug that temporary resources are returned to the wrong manager.