79192372

Date: 2024-11-15 12:31:10
Score: 1
Natty:
Report link

I think I've found a solution, which is though not as convenient as direct indexing:

i, j = mask.nonzero(as_tuple = True)
x[i, j, :, :3] = y[i, j]

However, in situation that shape of the masked dimensions are unknown, an additional reshaping will be involved to squeeze the unknown dimensions in one, which still cause extra time and memory. So I still think that it is nonsense that mask and slice assignment cannot be used simultaneously.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: LibrarristShalinward