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 & 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 poweredTulis LaTeX menggunakan AI

Editor LaTeX AI Terbaik, Alternatif Overleaf

Octree membantu peneliti dari 15+ universitas menulis makalah penelitian lebih cepat menggunakan AI

  • Hasilkan diagram TikZ yang indah menggunakan AI
  • Unggah gambar dan konversi ke LaTeX dengan mulus
  • Dapatkan bantuan instan untuk menulis dan memformat makalah penelitian