TorchLean API

NN.Runtime.Autograd.Engine.Cuda.Convert

Flatten (Spec.TensorFloatArray) #

Row-major order with outermost axis first and innermost axis last.

Worker for flattenFloat.

The accumulator lets us append in one left-to-right row-major traversal instead of repeatedly concatenating intermediate arrays.

Instances For

    Flatten a Spec.Tensor Float s into a row-major FloatArray (CUDA-compatible).

    Instances For

      Worker for flattenBoolMask; true is encoded as 1.0, false as 0.0.

      Instances For

        Flatten a Spec.Tensor Bool s mask to FloatArray as 0.0/1.0 values in row-major order.

        Instances For

          Unflatten (FloatArraySpec.Tensor) #

          These functions assume row-major order. The ? variants check the expected length and return none on mismatch.

          Worker for unflattenFloatUnsafe.

          offset is the row-major starting position for the current tensor subtree. The caller is responsible for ensuring the array contains at least offset + Shape.size s elements.

          Instances For

            Unflatten a row-major FloatArray into a Spec.Tensor Float s (unsafe: assumes correct size).

            Instances For

              Unflatten a row-major FloatArray into a Spec.Tensor Float s when a.size matches.

              Instances For

                Worker for unflattenBoolMaskUnsafe.

                The CUDA mask convention is deliberately simple: zero means false, any nonzero value means true.

                Instances For

                  Unflatten a FloatArray into a Spec.Tensor Bool s mask (unsafe: nonzero = true).

                  Instances For

                    Unflatten a FloatArray into a Spec.Tensor Bool s mask when a.size matches.

                    Instances For