From 30a4b593d7f85ae5172bd660bfab6085050cd633 Mon Sep 17 00:00:00 2001 From: Laurent Mazare Date: Thu, 31 Aug 2023 23:28:48 +0200 Subject: [PATCH] More ops again. (#697) --- candle-core/src/tensor.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/candle-core/src/tensor.rs b/candle-core/src/tensor.rs index 6108b6136b..0f48dc623d 100644 --- a/candle-core/src/tensor.rs +++ b/candle-core/src/tensor.rs @@ -2088,6 +2088,22 @@ macro_rules! bin_trait { } } + impl> std::ops::$trait for Result { + type Output = Result; + + fn $fn1(self, rhs: Tensor) -> Self::Output { + Tensor::$fn1(self?.borrow(), &rhs) + } + } + + impl> std::ops::$trait<&Tensor> for Result { + type Output = Result; + + fn $fn1(self, rhs: &Tensor) -> Self::Output { + Tensor::$fn1(self?.borrow(), rhs) + } + } + impl> std::ops::$trait> for Tensor { type Output = Result;