“ train_dataset [“ train_set_x”] [:]“在我的代码中是什么意思?

时间:2019-07-16 10:06:15

标签: python

我正在运行Coursera的deeplearning.ai课程中的lr_utils.py代码。

我尝试将“ train_x”,y更改为“ train_a”,b,“ train_set_x”并将y更改为a和b,代码未运行。

train_xtrain_y是什么意思? 字符串train_set_xtrain_set_y到底是什么? 字符串train_set_xtrain_set_y是否属于任何表中的列名?

谢谢

def load_train_data():

    train_dataset = h5py.File('datasets/train_catvnoncat.h5', "r")
    train_x = np.array(train_dataset["train_set_x"][:]) # train images
    train_y = np.array(train_dataset["train_set_y"][:]) # train label

    return train_x, train_y
def load_train_data():

    train_dataset = h5py.File('datasets/train_catvnoncat.h5', "r")
    train_a = np.array(train_dataset["train_set_a"][:]) # train images
    train_b = np.array(train_dataset["train_set_b"][:]) # train label

    return train_a, train_b

KeyError:“无法打开对象(对象'train_set_a'不存在)”

0 个答案:

没有答案