Skip to content

Commit

Permalink
More ops again. (huggingface#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentMazare authored Aug 31, 2023
1 parent 949f1ea commit 30a4b59
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions candle-core/src/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,22 @@ macro_rules! bin_trait {
}
}

impl<B: std::borrow::Borrow<Tensor>> std::ops::$trait<Tensor> for Result<B> {
type Output = Result<Tensor>;

fn $fn1(self, rhs: Tensor) -> Self::Output {
Tensor::$fn1(self?.borrow(), &rhs)
}
}

impl<B: std::borrow::Borrow<Tensor>> std::ops::$trait<&Tensor> for Result<B> {
type Output = Result<Tensor>;

fn $fn1(self, rhs: &Tensor) -> Self::Output {
Tensor::$fn1(self?.borrow(), rhs)
}
}

impl<B: std::borrow::Borrow<Tensor>> std::ops::$trait<Result<B>> for Tensor {
type Output = Result<Tensor>;

Expand Down

0 comments on commit 30a4b59

Please sign in to comment.