Class TensorScope

java.lang.Object
io.github.kirstenali.deepj.tensor.TensorScope
All Implemented Interfaces:
AutoCloseable

public final class TensorScope extends Object implements AutoCloseable
Bounds internal view lifetimes, without releasing saved or explicitly retained storage. Views created inside a scope are temporary; return them through escape(Tensor). Closing a scope permits later device cleanup, but never performs a download or allocation.
  • Method Details

    • open

      public static TensorScope open()
    • escape

      public Tensor escape(Tensor tensor)
    • external

      public static <T> T external(Supplier<T> operation)
      User callbacks must not inherit the library's private lifetime boundary.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable