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 TypeMethodDescriptionvoid
close()
static void
RegistersNDArray
object to this scope.void
A method that does nothing.static void
unregister
(NDArray array) UnregistersNDArray
object from this scope.static void
unregister
(NDArray... arrays) UnregistersNDArray
object from this scope.static void
unregister
(NDList ndlist) UnregistersNDArray
object from this scope.
-
Constructor Details
-
NDScope
public NDScope()Constructs a newNDScope
instance.
-
-
Method Details
-
register
RegistersNDArray
object to this scope.- Parameters:
array
- theNDArray
object
-
unregister
UnregistersNDArray
object from this scope.- Parameters:
array
- theNDArray
object
-
unregister
UnregistersNDArray
object from this scope.- Parameters:
arrays
- the array ofNDArray
object
-
unregister
UnregistersNDArray
object from this scope.- Parameters:
ndlist
- theNDList
object
-
close
public void close()- Specified by:
close
in 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.
-