Skip to content

Instantly share code, notes, and snippets.

@fac2003
Created November 10, 2017 19:37
Show Gist options
  • Save fac2003/c768a2c148e8f8dee03f867b45c05f27 to your computer and use it in GitHub Desktop.
Save fac2003/c768a2c148e8f8dee03f867b45c05f27 to your computer and use it in GitHub Desktop.
while (iterator.hasNext() && shouldWork.get()) {
DataSet smth = null;
if (useWorkspace) {
try (MemoryWorkspace ws = workspace.notifyScopeEntered()) {
smth = iterator.next();
if (callback != null)
callback.call(smth);
}
} else {
smth = iterator.next();
if (callback != null)
callback.call(smth);
}
// we want to ensure underlying iterator finished dataset creation
Nd4j.getExecutioner().commit();
if (smth != null)
queue.put(smth);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment