⊙\odot

⊙ — element-wise product

Read "a times b, element-wise". Multiply two same-shaped vectors or matrices position by position. This is not matrix multiplication.

(a⊙b)i=aibi(\mathbf{a} \odot \mathbf{b})_i = a_i b_i. The output has the same shape as the inputs. In NumPy and PyTorch it is a * b, while matrix multiplication is a @ b. It is also called the Hadamard product.

It appears wherever each feature gets its own scale: the learned gain γ\boldsymbol{\gamma} in LayerNorm and RMSNorm, and the gate in SwiGLU, where one branch scales the other entry by entry. Some texts write ⊗\otimes for the same thing, though ⊗\otimes can also mean other kinds of product.

Example

[1,2,3]⊙[4,5,6]=[4,10,18][1, 2, 3] \odot [4, 5, 6] = [4, 10, 18]

First times first, second times second, third times third.

Where the course uses it

Related terms