cos_
cos_(
x: &Tensor<T>,
out: &mut Tensor<C> | Tensor<C>
) -> Result<Tensor<C>, TensorError>
Trigonometric cosine with out
Parameters:
x: Angle(radians) out: Tensor to write to
Returns:
Tensor with type C
Examples:
use hpt::{common::TensorInfo, error::TensorError, ops::FloatUnaryOps, Tensor};
fn main() -> Result<(), TensorError> {
let a = Tensor::<f32>::new([10.0]);
let b = a.cos_(&mut a.clone())?;
println!("{}", b);
assert_eq!(a.ptr().ptr as u64, b.ptr().ptr as u64);
Ok(())
}
Backend Support
| Backend | Supported |
|---|---|
| CPU | ✅ |
| Cuda | ✅ |