Package ai.djl.ndarray
Class NDScope
java.lang.Object
ai.djl.ndarray.NDScope
- All Implemented Interfaces:
AutoCloseable
A class that tracks
NDResource objects created in the try-with-resource block and close
them automatically when out of the block scope.
This class has been derived from org.bytedeco.javacpp.PointerScope by Samuel Audet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static voidRegistersNDArrayobject to this scope.voidA method that does nothing.static voidunregister(NDArray array) UnregistersNDArrayobject from this scope.static voidunregister(NDArray... arrays) UnregistersNDArrayobject from this scope.static voidunregister(NDList ndlist) UnregistersNDArrayobject from this scope.
-
Constructor Details
-
NDScope
public NDScope()Constructs a newNDScopeinstance.
-
-
Method Details
-
register
RegistersNDArrayobject to this scope.- Parameters:
array- theNDArrayobject
-
unregister
UnregistersNDArrayobject from this scope.- Parameters:
array- theNDArrayobject
-
unregister
UnregistersNDArrayobject from this scope.- Parameters:
arrays- the array ofNDArrayobject
-
unregister
UnregistersNDArrayobject from this scope.- Parameters:
ndlist- theNDListobject
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
suppressNotUsedWarning
public void suppressNotUsedWarning()A method that does nothing.You may use it if you do not have a better way to suppress the warning of a created but not explicitly used scope.
-