I’d like to create a 4D mask where the elements are determined by $M[i, j, k, l] = \delta_{i+j, k+l}$. Does anyone have a recommendation for how to do this?
Can you please rewrite the equation? It’s hard to understand.
Sure. M[i, j, k, l] = 1
if i + j == k + l
and 0 otherwise.