docsapi referencedarkforest-core-ops-neg
API Referencecrate: darkforest-coresince v0.1.0-alpha

neg

Numerical negation of all tensor elements.

neg

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

Signature

rust
pub fn neg<T: Element, D: Device>(a: &Tensor<T, D>) -> Result<Tensor<T, D>, OpError>

Overview

Numerical negation of all tensor elements.

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 neg
let _res = darkforest_core::ops::neg();

Related Components