Skip to content

Commit

Permalink
Add tanh to two way ops
Browse files Browse the repository at this point in the history
  • Loading branch information
elftausend committed Nov 19, 2023
1 parent 6d9a2d5 commit 2c12174
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/two_way_ops/ops/unary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,27 @@ impl<C: ToCLSource> ToCLSource for Tan<C> {
}
}

pub struct Tanh<C> {
pub comb: C,
}

impl<C> Combiner for Tanh<C> {}

impl<T: Float, C: Eval<T>> Eval<T> for Tanh<C> {
#[inline]
fn eval(self) -> T {
Float::tanh(&self.comb.eval())
}
}

#[cfg(not(feature = "no-std"))]
impl<C: ToCLSource> ToCLSource for Tanh<C> {
#[inline]
fn to_cl_source(&self) -> String {
format!("tanh({})", self.comb.to_cl_source())
}
}

pub struct Neg<C> {
pub comb: C,
}
Expand Down

0 comments on commit 2c12174

Please sign in to comment.