Hadamard (elementwise) product
Multiply two arrays of the same shape entry by entry.
In ML papers
multiplies matching entries: . Both sides have the same shape, and so does the result. LSTM and GRU gates use it to scale a state entry by entry (), normalization layers use it to apply the learned scale , and backpropagation uses it to multiply by an activation's derivative. In NumPy and PyTorch it is the plain * operator.
How to type it
| LaTeX | Shows |
|---|---|
\odot |
A worked example
Compare the dot product, which would add these up to 32.
Common confusions
- Some papers write it (Composition (circle)) or , or just put the two side by side. Check the shapes: if they match and no sum is implied, it is elementwise.
- It is not a matrix product: .