我有這個子代碼Python和我不明白它是什麼或做什麼的,尤其是這樣一句話:在numpy中X [:,:,:,i]是什麼意思?
X[:,:,:,i]
子碼是:
train_dict = sio.loadmat(train_location)
X = np.asarray(train_dict['X'])
X_train = []
for i in range(X.shape[3]):
X_train.append(X[:,:,:,i])
X_train = np.asarray(X_train)
Y_train = train_dict['y']
for i in range(len(Y_train)):
if Y_train[i]%10 == 0:
Y_train[i] = 0
Y_train = to_categorical(Y_train,10)
return (X_train,Y_train)
它看起來像X是一個4D陣列,所以你切出一個3D切片並將其附加到X_train。 –
正如僅供參考,我不認爲「子代碼」是一個真正的詞。我很欣賞你嘗試投入它。 –
@cᴏʟᴅsᴘᴇᴇᴅthanks你u – AAA