Skip to content

larq.math

Math operations that are specific to extremely quantized networks.

[source]

sign

larq.math.sign(x)

A sign function that will never be zero \[ f(x) = \begin{cases} -1 & x < 0 \\ \hphantom{-}1 & x \geq 0 \end{cases} \]

This function is similar to tf.math.sign but will return a binary value and will never be zero.

Arguments

  • x: Input Tensor

Returns

A Tensor with same type as x.


[source]

heaviside

larq.math.heaviside(x)

Heaviside step function with output values 0 and 1.

\[ q(x) = \begin{cases} +1 & x > 0 \\ \hphantom{+}0 & x \leq 0 \end{cases} \]

Arguments

  • x: Input Tensor

Returns

A Tensor with same type as x.