Clear the collector.
Iterate over the collected NDArrays and apply the user-defined function to each NDArray.
Iterate over the collected NDArrays and apply the user-defined function to each NDArray.
the function that is applied for its side-effect to every NDArray. The result of function f is discarded.
how many unique NDArrays are collected.
Create a code scope, NDArrays allocated within this scope will be collected.
Create a code scope, NDArrays allocated within this scope will be collected.
The collected NDArrays will be either
- disposed automatically when the code block finishes (when using auto) or
- stored for later access (when using manual)
If the return type of scope is NDArray or NDArrayFuncReturn,
it 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.
We might switch to try -with-resources statement (by AutoCloseable in Java 1.7+)
and deprecate this method later, thus it is marked as Experimental.
return type of the function codeBlock.
code block to be executed within the scope.
The result of function codeBlock.
(Since version 1.5.0) Please use ResourceScope instead
(Since version 1.5.0) Please use ResourceScope instead