diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2023-07-20 13:28:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-20 12:28:45 +0100 |
commit | 2a8f28d687b5a33c6c91f40100a42baf6e2fc10a (patch) | |
tree | ee76b9df39f52212666ad6f2096be541973cdafd /candle-core/src/tensor.rs | |
parent | e9c052bf94521b418852a1c5231c12ddce99a78f (diff) | |
download | candle-2a8f28d687b5a33c6c91f40100a42baf6e2fc10a.tar.gz candle-2a8f28d687b5a33c6c91f40100a42baf6e2fc10a.tar.bz2 candle-2a8f28d687b5a33c6c91f40100a42baf6e2fc10a.zip |
Op refactor (#208)
* Add the binary and unary op enums to factorize some code.
* Bugfix.
Diffstat (limited to 'candle-core/src/tensor.rs')
-rw-r--r-- | candle-core/src/tensor.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/candle-core/src/tensor.rs b/candle-core/src/tensor.rs index d6c3e9cb..087a2ff5 100644 --- a/candle-core/src/tensor.rs +++ b/candle-core/src/tensor.rs @@ -1,5 +1,5 @@ use crate::backend::{BackendDevice, BackendStorage}; -use crate::op::{CmpOp, Op, ReduceOp}; +use crate::op::{BinaryOp, CmpOp, Op, ReduceOp, UnaryOp}; use crate::shape::{Dim, Dims}; use crate::{storage::Storage, DType, Device, Error, Layout, Result, Shape}; use std::sync::{Arc, RwLock}; @@ -80,7 +80,7 @@ macro_rules! unary_op { .storage() .unary_impl::<crate::op::$op_name>(self.layout())?; let op = if self.track_op() { - Some(Op::$op_name(self.clone())) + Some(Op::Unary(self.clone(), UnaryOp::$op_name)) } else { None }; @@ -99,7 +99,7 @@ macro_rules! binary_op { rhs.layout(), )?; let op = if self.track_op() || rhs.track_op() { - Some(Op::$op_name(self.clone(), rhs.clone())) + Some(Op::Binary(self.clone(), rhs.clone(), BinaryOp::$op_name)) } else { None }; |