我有一些代码,它基本上将long numpy数组的某些元素设置为零.
import numpy as np
a = np.array([[[1, 2, 3, 4], [0, 1, 2, 3], [1, 2, 3, 4]],
[[0, 1, 2, 3], [0, 0, 1, 2], [0, 2, 3, 4]]])
aup = a + 2
b = np.array([[[0, 1, 2], [3, 4, 5], [0, 2, 3], [5, 6, 7], [0, 1, 2]],
[[3, 4, 5], [0, 2, 3], [5, 6, 7], [0, 1, 2], [3, 4, 5]],
[[0, 1, 2], [3, 4, 5], [0, 2, 3], [5, 6, …Run Code Online (Sandbox Code Playgroud)