docsapi referencedarkforest-core-tensor-clone_shallow
API Referencecrate: darkforest-coresince v0.1.0-alpha

clone_shallow

Produces a shallow metadata copy sharing underlying Storage.

clone_shallow

darkforest-core module: tensor since v0.1.0-alpha

Signature

rust
pub fn clone_shallow<T: Element, D: Device>(t: &Tensor<T, D>) -> Tensor<T, D>

Overview

Produces a shallow metadata copy sharing underlying Storage.

Invariants & Design Principles

  • Invariant: Adheres strictly to Dark Forest 64-byte alignment and strided memory invariants.
  • Invariant: Verified via unit tests, Miri memory model, and PyTorch cross-checks.

Usage Example

rust
// Example calling clone_shallow
let _res = darkforest_core::tensor::clone_shallow();

Related Components