summaryrefslogtreecommitdiff
path: root/candle-core/src/cuda_backend/mod.rs
diff options
context:
space:
mode:
authorMilkFather <31627231+MilkFather@users.noreply.github.com>2024-04-29 17:04:43 +0800
committerGitHub <noreply@github.com>2024-04-29 11:04:43 +0200
commit3bbb88fcb463a6bdbb0e71c7b2d211dd02681493 (patch)
tree6077a6f41f7b1ed97b6f44d5e8305126c0d5f5a5 /candle-core/src/cuda_backend/mod.rs
parented7b99f525ab898aa677fe1f4446e345ac74f4ec (diff)
downloadcandle-3bbb88fcb463a6bdbb0e71c7b2d211dd02681493.tar.gz
candle-3bbb88fcb463a6bdbb0e71c7b2d211dd02681493.tar.bz2
candle-3bbb88fcb463a6bdbb0e71c7b2d211dd02681493.zip
Fix sigmoid gradient calculation and move sigmoid into a specialized op (#2114)
* add sigmoid op * small fix * add as a method on `Tensor` * implement gradient calculation for sigmoid * add sigmoid tests * we should have a specialized op for this * fix clippy * fix clippy 2 * Revert all previous commits in favor of a `CustomOp` based solution * use `CustomOp1` implementation * fix rustfmt * experimental add metal impl * add cuda kernel impl * fix fmt * Add a test + reduce some cuda duplication. --------- Co-authored-by: laurent <laurent.mazare@gmail.com>
Diffstat (limited to 'candle-core/src/cuda_backend/mod.rs')
-rw-r--r--candle-core/src/cuda_backend/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/candle-core/src/cuda_backend/mod.rs b/candle-core/src/cuda_backend/mod.rs
index a82c89ee..67ed56e0 100644
--- a/candle-core/src/cuda_backend/mod.rs
+++ b/candle-core/src/cuda_backend/mod.rs
@@ -18,7 +18,7 @@ pub use device::{CudaDevice, DeviceId};
pub use error::{CudaError, WrapErr};
pub use utils::{Map1, Map1Any, Map2, Map2Any, Map2InPlace, S};
-enum SlicePtrOrNull<T> {
+pub enum SlicePtrOrNull<T> {
Ptr(CudaSlice<T>),
Null,
}
@@ -33,7 +33,7 @@ unsafe impl<T: DeviceRepr> DeviceRepr for &SlicePtrOrNull<T> {
}
impl SlicePtrOrNull<usize> {
- fn params_from_layout(dev: &CudaDevice, l: &Layout) -> Result<Self> {
+ pub fn params_from_layout(dev: &CudaDevice, l: &Layout) -> Result<Self> {
let ds = if l.is_contiguous() {
SlicePtrOrNull::Null
} else {