Vectors and matrices

a⊙b\mathbf{a} \odot \mathbf{b} Hadamard (elementwise) product

Multiply two arrays of the same shape entry by entry.

In ML papers

a⊙b\mathbf{a} \odot \mathbf{b} multiplies matching entries: (a⊙b)i=aibi(\mathbf{a} \odot \mathbf{b})_i = a_i b_i. Both sides have the same shape, and so does the result. LSTM and GRU gates use it to scale a state entry by entry (ft⊙ct−1\mathbf{f}_t \odot \mathbf{c}_{t-1}), normalization layers use it to apply the learned scale γ\boldsymbol{\gamma}, and backpropagation uses it to multiply by an activation's derivative. In NumPy and PyTorch it is the plain * operator.

How to type it

LaTeXShows
\odot⊙\odot

A worked example

(1,2,3)⊙(4,5,6)=(4,10,18)(1, 2, 3) \odot (4, 5, 6) = (4, 10, 18)

Compare the dot product, which would add these up to 32.

Common confusions

Equations that use it

Related

a⊗b\mathbf{a} \otimes \mathbf{b}Tensor / Kronecker producta⋅b\mathbf{a} \cdot \mathbf{b}Centre dotf∘gf \circ gComposition (circle)x∈Rd\mathbf{x} \in \mathbb{R}^{d}Bold lowercase (vector)

Decode this example →