Hi @sajastu,
Can you explain how do you obtain 3 for Avg(A[0][1]) when A[0][1] == [0, 0, 0]?
I would expect this output:
Avg(A) = [[2, 0, 4  ],
          [0, 6, 1.5]]


There might be (I hope) a cleaner way, but you can do this:
avg = A.sum(axis=2) / (A != 0).sum(axis=2).clamp(min=1).float()

(clamp to avoid division by zero)
EDIT: whoops, I misread “without taking zero in arrays into account”, above solution does not count. Still I am curious to know how you get this output