Package ai.djl.ndarray
Class NDScope
- java.lang.Object
-
- ai.djl.ndarray.NDScope
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class NDScope extends java.lang.Object implements java.lang.AutoCloseableA class that tracksNDResourceobjects 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.PointerScopeby Samuel Audet
-
-
Constructor Summary
Constructors Constructor Description NDScope()Constructs a newNDScopeinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static voidregister(NDArray array)RegistersNDArrayobject to this scope.voidsuppressNotUsedWarning()A method that does nothing.static voidunregister(NDArray array)UnregistersNDArrayobject from this scope.
-
-
-
Method Detail
-
register
public static void register(NDArray array)
RegistersNDArrayobject to this scope.- Parameters:
array- theNDArrayobject
-
unregister
public static void unregister(NDArray array)
UnregistersNDArrayobject from this scope.- Parameters:
array- theNDArrayobject
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
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.
-
-