ReLU in LaTeX (\text{ReLU})

ReLU\text{ReLU}
LaTeX command
\text{ReLU}
Package
Add to your preamble:\usepackage{amsmath}
Mode
Text and math mode

Where it is used

Name of the rectified linear unit activation, which outputs max(0, x) and zeroes negative inputs.

ReLU is defined as \text{ReLU}(x) = \max(0, x), with derivative 1 for positive inputs and 0 for negative ones. It is the default hidden-layer activation in modern networks; variants include Leaky ReLU, \max(\alpha x, x), and GELU. Writing \text{ReLU} works, but it follows the surrounding text style, so in an italic environment it slants; \operatorname{ReLU} or \mathrm{ReLU} stays upright and \operatorname also handles spacing before the argument. When applied to a vector, state that it acts elementwise, as in \text{ReLU}(\mathbf{W}\mathbf{x} + \mathbf{b}).

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

h=ReLU(Wx+b)\mathbf{h} = \text{ReLU}(\mathbf{W}\mathbf{x} + \mathbf{b})
\documentclass{article}
\usepackage{amsmath}
\begin{document}
ReLU: $\text{ReLU}$

\[ \mathbf{h} = \text{ReLU}(\mathbf{W}\mathbf{x} + \mathbf{b}) \]
\end{document}

Related symbols

All Machine Learning at AI →

Frequently asked questions

How do I write ReLU in LaTeX?
Type \text{ReLU} in math mode, for example $\mathbf{h} = \text{ReLU}(\mathbf{W}\mathbf{x} + \mathbf{b})$. Load amsmath first with \usepackage{amsmath}.
Which package do I need for \text{ReLU}?
\text{ReLU} needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
Can I use \text{ReLU} in text mode, or only in math mode?
Both. \text{ReLU} compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
Math poweredSumulat ng LaTeX gamit ang AI

Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf

Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI

  • Gumawa ng magagandang TikZ diagrams gamit ang AI
  • Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
  • Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers