# Evaluation of ReLU Activation Function through Scheme Switching

**URL:** <https://openfhe.discourse.group/t/evaluation-of-relu-activation-function-through-scheme-switching/1879>\
**Category:** Library Questions\
**Tags:** questions\
**Created:** [February 18, 2025, 6:52am UTC](https://openfhe.discourse.group/t/evaluation-of-relu-activation-function-through-scheme-switching/1879 "2025-02-18T06:52:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![andreea.alexandru](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/andreea.alexandru/32/378_2.png) [@andreea.alexandru](https://openfhe.discourse.group/u/andreea.alexandru)\
**Post date:** [February 18, 2025, 3:16pm UTC](https://openfhe.discourse.group/t/evaluation-of-relu-activation-function-through-scheme-switching/1879/2 "2025-02-18T15:16:33Z")

</div>

The EvalFunc only works with plaintext modulus up to p = 8 (see the paragraph [here](https://github.com/openfheorg/openfhe-development/blob/main/src/pke/examples/SCHEME_SWITCHING_CAPABILITY.md) about `GenerateLUTviaFunction`). I don’t see what inputs you use. Also, returning from FHEW to CKKS works when the message is significantly smaller than the plaintext modulus (see the above link, as well as the [example](https://github.com/openfheorg/openfhe-development/blob/main/src/pke/examples/scheme-switching.cpp#L499), which for p = 8 reduces the range of the message by quite a lot.

To implement ReLU, a much better option is to use scheme switching to compute the sign of you ciphertext, for instance, with `EvalCompareSchemeSwitching`, which returns a vector of elements encrypting zero for positive values and 1 for negative values, and then multiply your ciphertext by (1-sign). See also [How to calculate ReLU function through ciphertext conversion? - #2 by andreea.alexandru](https://openfhe.discourse.group/t/how-to-calculate-relu-function-through-ciphertext-conversion/1658/2).

---

_[View the full topic](https://openfhe.discourse.group/t/evaluation-of-relu-activation-function-through-scheme-switching/1879)._
