Struct ciphercore_base::ops::pwl::approx_sigmoid::ApproxSigmoid
source · pub struct ApproxSigmoid {
pub precision: u64,
}
Expand description
A structure that defines the custom operation ApproxSigmoid that computes an approximate Sigmoid(x / (2 ** precision)) * (2 ** precision) using piecewise-linear approximation.
Sigmoid is a very commonly used function in ML: Sigmoid(x) = 1 / (1 + exp(-x)). So far this operation supports only INT64 scalar type.
Custom operation arguments
- Node containing a signed 64-bit array or scalar to compute the sigmoid
Custom operation returns
New ApproxSigmoid node
Example
let c = create_context().unwrap();
let g = c.create_graph().unwrap();
let t = array_type(vec![3], INT64);
let x = g.input(t.clone()).unwrap();
let n = g.custom_op(CustomOperation::new(ApproxSigmoid {precision: 4}), vec![x]).unwrap();
Fields§
§precision: u64
Assume that we’re operating in fixed precision arithmetic with denominator 2 ** precision.
Trait Implementations§
source§impl CustomOperationBody for ApproxSigmoid
impl CustomOperationBody for ApproxSigmoid
source§impl Debug for ApproxSigmoid
impl Debug for ApproxSigmoid
source§impl<'de> Deserialize<'de> for ApproxSigmoid
impl<'de> Deserialize<'de> for ApproxSigmoid
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for ApproxSigmoid
impl Hash for ApproxSigmoid
source§impl PartialEq<ApproxSigmoid> for ApproxSigmoid
impl PartialEq<ApproxSigmoid> for ApproxSigmoid
source§fn eq(&self, other: &ApproxSigmoid) -> bool
fn eq(&self, other: &ApproxSigmoid) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ApproxSigmoid
impl Serialize for ApproxSigmoid
impl Eq for ApproxSigmoid
impl StructuralEq for ApproxSigmoid
impl StructuralPartialEq for ApproxSigmoid
Auto Trait Implementations§
impl RefUnwindSafe for ApproxSigmoid
impl Send for ApproxSigmoid
impl Sync for ApproxSigmoid
impl Unpin for ApproxSigmoid
impl UnwindSafe for ApproxSigmoid
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.