Numpy padding 4D units with all zeros
问题 I have a 4D numpy array, but each element is a variable size 3D volume. Essentially it is a numpy list of 3D volumes. So the numpy array has the shape... (Pdb) batch_x.shape (3,) And take element i in that list, and it looks like this... (Pdb) batch_x[i].shape (7, 70, 66) I'm trying to pad each 3D volume with zeros, with the following code... for i in range(batch_size): pdb.set_trace() batch_x[i] = np.lib.pad(batch_x[i], (n_input_z - int(batch_x[i][:,0,0].shape[0]), n_input_x - int(batch_x[i]