docsapi referencedarkforest-py-interop-from_torch
API Referencecrate: darkforest-pysince v0.1.0-alpha

from_torch

Zero-copy ingestion of PyTorch tensors into Dark Forest.

from_torch

darkforest-py module: interop since v0.1.0-alpha

Signature

rust
#[pyfunction] pub fn from_torch(py: Python, torch_tensor: PyObject) -> PyResult<PyTensor>

Overview

Zero-copy ingestion of PyTorch tensors into Dark Forest.

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 from_torch
let _res = darkforest_py::interop::from_torch();

Related Components