I mean you sample 30 examples per plane. Each of examples is located at the same coords [xi,yi]. Your script is generating 30 different positions per batch, not per each plane. Thus, if this is not a mistake, you can slice through planes to retrieve 30 stacks of 1x128, since sample[i] is always at [xi,yi]