Class TensorStorageAccess

java.lang.Object
io.github.kirstenali.deepj.tensor.TensorStorageAccess
Direct Known Subclasses:
TensorManipulations

public abstract class TensorStorageAccess extends Object
Shared physical storage plumbing; logical Tensor operations remain on the concrete facade.
  • Method Details

    • coversStorage

      public final boolean coversStorage()
      Whether immutable logical geometry covers the whole allocation contiguously from offset zero.
    • rank

      public final int rank()
    • shape

      public final int[] shape()
    • hasShape

      public final boolean hasShape(int... dimensions)
      Tests exact logical dimensions without copying shape metadata or reading tensor values.
    • size

      public final int size(int axis)
    • numel

      public final int numel()
    • hasSameShape

      public final boolean hasSameShape(TensorStorageAccess other)
    • strides

      public final long[] strides()
    • storageOffset

      public final int storageOffset()
    • isContiguous

      public final boolean isContiguous()
    • storageBytes

      public final long storageBytes()
      Physical bytes in the shared allocation; views may address only part of it.
    • matrixRows

      public final int matrixRows()
      Checked rank-two dimensions for matrix kernels; other ranks are never implicitly flattened.
    • matrixCols

      public final int matrixCols()
    • materialize

      public abstract void materialize()
    • get

      public final float get(int row, int column)
    • get

      public final float get(int... indices)
    • set

      public final void set(int row, int column, float value)
    • setAt

      public final void setAt(float value, int... indices)
    • toFloatArray

      public final float[] toFloatArray()
      Returns a logical row-major copy, converting compact storage to FLOAT32 values when necessary.
    • gradientState

      public final GradientState gradientState()
    • getGpuTag

      public final Object getGpuTag()
    • setGpuTag

      public final void setGpuTag(Object tag)
    • dtype

      public final DType dtype()
    • hasHostStorage

      public final boolean hasHostStorage()
      False for lazy storage that has never been touched on the host; such storage reads as zeros.
    • rawData

      public final float[] rawData()
      Unsafe backing access bypasses mutation tracking; use managed Tensor get/set for application code.
    • retainsDeviceBuffer

      public final boolean retainsDeviceBuffer()
    • releaseDeviceBufferRetention

      public final void releaseDeviceBufferRetention()