Softmax in LaTeX (\text{softmax})
- LaTeX command
\text{softmax}- Package
- Add to your preamble:
\usepackage{amsmath} - Mode
- Text and math mode
Where it is used
Softmax function name: maps a vector of logits to a probability distribution by exponentiating and normalizing.
Softmax is defined componentwise as \text{softmax}(z)_i = e^{z_i} / \sum_j e^{z_j}, and it closes nearly every classifier and the attention mechanism, where \text{softmax}(QK^\top/\sqrt{d_k})V. Because \text{} uses the surrounding text font, it turns italic inside theorem or emphasis environments. \operatorname{softmax} is usually the better choice: it is always upright and adds operator spacing before the parenthesis, just like \sin. A temperature parameter is written as \text{softmax}(z/T). Use \left( \right) when the argument contains a fraction. In code-heavy papers, say which axis softmax normalizes over, such as the class dimension.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Softmax: $\text{softmax}$
\[ \text{softmax}(z)_i = \frac{e^{z_i}}{\sum_{j=1}^{K} e^{z_j}} \]
\end{document}Related symbols
- Sigma
\sigma - Circle Dot
\odot - ReLU
\text{ReLU} - Tensor Product
\otimes - Nabla
\nabla - Argmin Subscript
\arg\min_{\theta}
Frequently asked questions
- How do I write Softmax in LaTeX?
- Type \text{softmax} in math mode, for example $\text{softmax}(z)_i = \frac{e^{z_i}}{\sum_{j=1}^{K} e^{z_j}}$. Load amsmath first with \usepackage{amsmath}.
- Which package do I need for \text{softmax}?
- \text{softmax} needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
- Can I use \text{softmax} in text mode, or only in math mode?
- Both. \text{softmax} compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
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