random_state.shuffle在Python中引发异常

时间:2020-02-20 20:56:36

标签: python numpy

我正在尝试在Python中调用random_state.shuffle方法,并不断出现以下错误:

 random_state.shuffle(class_data)
  File "mtrand.pyx", line 4417, in numpy.random.mtrand.RandomState.shuffle
TypeError: len() of unsized object

我已经初始化了random_state,如下所示:

random_state = np.random.RandomState(100)

之后,我尝试创建SFrame:

def build_bitmap_sframe():
    bitmaps_list, labels_list = [], []
    for category in categories:
        class_data = np.load(os.path.join(bitmap_directory, category + ".npy"))
        print(class_data)
        random_state.shuffle(class_data) # this line error

我想念什么?

以下是文档的链接:https://apple.github.io/turicreate/docs/userguide/drawing_classifier/data-preparation.html

0 个答案:

没有答案