Skip to main content

binarize_sign_no_grad

Function binarize_sign_no_grad 

Source
pub fn binarize_sign_no_grad(x: &Tensor) -> Result<Tensor>
Expand description

Binarize a floating-point tensor without tracking gradients: values >= 0 map to +1, values < 0 map to -1.

Matches PyTorch y = x.sign(); y[y == 0] = 1.

ยงErrors

Returns a crate::LittleBitError::Candle error if the tensor operation fails.