From 90e06540bb9225970194af0e05177688197065b2 Mon Sep 17 00:00:00 2001 From: Gonzalo <456459+grzuy@users.noreply.github.com> Date: Wed, 8 Nov 2023 13:35:09 -0300 Subject: [PATCH] cargo fmt --- native/candlex/src/tensors.rs | 37 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/native/candlex/src/tensors.rs b/native/candlex/src/tensors.rs index 84d960d..679e10b 100644 --- a/native/candlex/src/tensors.rs +++ b/native/candlex/src/tensors.rs @@ -275,25 +275,24 @@ pub fn qr(tensor: ExTensor) -> Result<(ExTensor, ExTensor), CandlexError> { let side = tensor.dims()[0]; let device = tensor.device(); - let qr = - nalgebra::linalg::QR::new( - nalgebra::DMatrix::from_vec( - side, - side, - tensor.t()?.flatten_all()?.to_vec1::()? - ) - ); - - Ok( - ( - ExTensor::new( - Tensor::new(qr.q().as_slice(), &device)?.reshape((side, side))?.t()? - ), - ExTensor::new( - Tensor::new(qr.r().as_slice(), &device)?.reshape((side, side))?.t()? - ) - ) - ) + let qr = nalgebra::linalg::QR::new(nalgebra::DMatrix::from_vec( + side, + side, + tensor.t()?.flatten_all()?.to_vec1::()?, + )); + + Ok(( + ExTensor::new( + Tensor::new(qr.q().as_slice(), &device)? + .reshape((side, side))? + .t()?, + ), + ExTensor::new( + Tensor::new(qr.r().as_slice(), &device)? + .reshape((side, side))? + .t()?, + ), + )) } #[rustler::nif(schedule = "DirtyCpu")]