Create a collector which will dispose the collected NDArrays automatically.
Create a collector which will dispose the collected NDArrays automatically.
an auto-disposable collector.
(Since version 1.5.0) Please use ResourceScope instead
Collect the NDArrays into the collector of the current thread.
Collect the NDArrays into the collector of the current thread.
NDArrays need to be collected.
(Since version 1.5.0) Please use ResourceScope instead
Create a collector allows users to later dispose the collected NDArray manually.
Create a collector allows users to later dispose the collected NDArray manually.
a manually-disposable collector.
(Since version 1.5.0) Please use ResourceScope instead
A collector to store NDArrays. It provides a scope, NDArrays allocated in the scope can either
If the return type of scope is NDArray or NDArrayFuncReturn, the collector is smart enough NOT to collect or dispose the returned NDArray.
However in other cases, it is users' responsibility NOT to leak allocated NDArrays outside, (e.g., store to a global variable and use later, pass to another thread, etc.)
Usage Example: In the case above, the intermediate NDArrays (created by NDArray.relu and +) will be disposed automatically.
User can also decide to dispose the collected NDArrays later:
For Java users:
(Since version 1.5.0) Please use ResourceScope instead