Weight Matrix in LaTeX (\mathbf{W})

W\mathbf{W}
LaTeX command
\mathbf{W}
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Bold upright W, the conventional notation for a weight matrix in a neural network layer.

Bold capitals denote matrices and bold lowercase letters denote vectors, so a dense layer is \mathbf{y} = \mathbf{W}\mathbf{x} + \mathbf{b}, with layer-specific weights written \mathbf{W}^{(l)} or \mathbf{W}_l. \mathbf produces upright bold Latin letters; it does not bold Greek letters or most symbols, so use \boldsymbol or \bm for \boldsymbol{\Sigma} or a bold \theta. Many deep learning papers drop the bold entirely and write W; choose one convention and keep it throughout. The transpose is usually \mathbf{W}^\top, which reads more cleanly than ^T.

Minimal compilable example

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

hl+1=σ(Wlhl+bl)\mathbf{h}_{l+1} = \sigma(\mathbf{W}_l \mathbf{h}_l + \mathbf{b}_l)
\documentclass{article}
\begin{document}
Weight Matrix: $\mathbf{W}$

\[ \mathbf{h}_{l+1} = \sigma(\mathbf{W}_l \mathbf{h}_l + \mathbf{b}_l) \]
\end{document}

Related symbols

All 機械学習・AI →

Frequently asked questions

How do I write Weight Matrix in LaTeX?
Type \mathbf{W} in math mode, for example $\mathbf{h}_{l+1} = \sigma(\mathbf{W}_l \mathbf{h}_l + \mathbf{b}_l)$. It works in plain LaTeX without loading any package.
Which package do I need for \mathbf{W}?
None. \mathbf{W} is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \mathbf{W} in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\mathbf{W}$ in running text.
Math poweredAIでLaTeXを書く

最高のAI LaTeXエディタ、Overleaf代替

Octreeは15以上の大学の研究者がAIを使って論文をより速く書くのを支援

  • AIで美しいTikZダイアグラムを生成
  • 画像をアップロードしてシームレスにLaTeXに変換
  • 論文の執筆とフォーマットに即座にサポートを取得