# 1. Print both shapes print(a.shape, b.shape) # 2. Align from the right on paper: a: 3,1 b: 1,4 -> out 3,4 — is that what you want? # 3. If not, unsqueeze or reshape to control which dim stretches