public final class MemoryScope
extends java.lang.Object
implements java.lang.AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
MemoryScope |
add(NDArray... arrays)
Adds the given arrays to this scopes sub manager.
|
MemoryScope |
add(NDList... lists)
Adds all arrays in the given lists to this memory scope.
|
void |
close()
Closes this scope by closing the sub manager used to manage it.
|
static MemoryScope |
from(NDArray ndArray)
Creates a new memory scope for the device of the given array and adds the array.
|
static MemoryScope |
from(NDList list)
Creates a new memory scope that fits the device of the first array in the given list, adds
all arrays in the given list.
|
NDManager |
getScopeManager()
Returns the NDManager used to manage this scopes resources.
|
MemoryScope |
remove(NDArray... arrays)
Remove the given arrays from this scope and attach them back to this scopes parent NDManager.
|
MemoryScope |
remove(NDList... lists)
Remove the given arrays from this scope and attach them back to this scopes parent NDManager.
|
MemoryScope |
waitToRead(NDArray... arrays)
Waits for all given arrays to be ready to read, i.e.
|
MemoryScope |
waitToRead(NDList... lists)
Waits for all arrays in all given lists to be ready to be read, i.e.
|
public MemoryScope add(NDList... lists)
lists - the lists whose arrays to add to this scope, may be emptypublic MemoryScope add(NDArray... arrays)
arrays - the arrays to addpublic MemoryScope remove(NDList... lists)
lists - the lists containing the arrays to removepublic MemoryScope remove(NDArray... arrays)
arrays - arrays to removepublic NDManager getScopeManager()
public MemoryScope waitToRead(NDArray... arrays)
arrays - arrays to wait forpublic MemoryScope waitToRead(NDList... lists)
lists - may be emptypublic void close()
close in interface java.lang.AutoCloseablepublic static MemoryScope from(NDArray ndArray)
ndArray - an arraypublic static MemoryScope from(NDList list)
list - a list of arrays, must not be empty