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/cuda_backend.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/cuda_backend.rs')
-rw-r--r-- | candle-core/src/cuda_backend.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/candle-core/src/cuda_backend.rs b/candle-core/src/cuda_backend.rs index 9e47c133..c9bb1fba 100644 --- a/candle-core/src/cuda_backend.rs +++ b/candle-core/src/cuda_backend.rs @@ -1,5 +1,5 @@ use crate::backend::{BackendDevice, BackendStorage}; -use crate::op::{CmpOp, ReduceOp}; +use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT}; use crate::{CpuStorage, DType, Layout, Result, Shape, WithDType}; use candle_kernels as kernels; use cudarc::cublas::{Gemm, GemmConfig, StridedBatchedConfig}; @@ -573,7 +573,7 @@ impl<'a> Map1 for FastReduce<'a> { } } -impl<U: crate::op::UnaryOp> Map1 for U { +impl<U: UnaryOpT> Map1 for U { fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>( &self, src: &CudaSlice<T>, @@ -716,7 +716,7 @@ impl<'a> Map2 for WhereCond<'a> { } } -impl<U: crate::op::BinaryOp> Map2 for U { +impl<U: crate::op::BinaryOpT> Map2 for U { fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>( &self, lhs: &CudaSlice<T>, @@ -976,13 +976,13 @@ impl BackendStorage for CudaStorage { Err(CudaError::InternalError("TODO: implement divide_by_sum_over_dim").into()) } - fn unary_impl<U: crate::op::UnaryOp>(&self, layout: &Layout) -> Result<Self> { + fn unary_impl<U: UnaryOpT>(&self, layout: &Layout) -> Result<Self> { let device = self.device().clone(); let slice = U::V.map(&self.slice, &device, layout)?; Ok(Self { slice, device }) } - fn binary_impl<B: crate::op::BinaryOp>( + fn binary_impl<B: BinaryOpT>( &self, rhs: &Self, lhs_l: &Layout, |