Flatten (TorchLean.Tensor → FloatArray) #
Row-major order with outermost axis first and innermost axis last.
Append the elements of a tensor to an accumulator in row-major order.
Instances For
Flatten a TorchLean.Tensor Float s into a row-major FloatArray (CUDA-compatible).
Instances For
Accumulating worker for flattenBoolMask: true becomes 1.0, false becomes 0.0, since
the CUDA side has no boolean buffers and reads masks as floats.
Instances For
Flatten a TorchLean.Tensor Bool s mask to FloatArray as 0.0/1.0 values in row-major
order.
Instances For
Unflatten (FloatArray → TorchLean.Tensor) #
These functions assume row-major order. The public operations check the expected length and return
none on mismatch. Runtime code that already owns the buffer-size invariant calls the internal
workers directly.
Read a tensor out of a starting at offset, trusting the caller for the bounds. The checked
entry point is unflattenFloat?; this one exists so a batched download can slice one array.
Instances For
Unflatten a row-major FloatArray into a TorchLean.Tensor Float s when a.size matches.