一、错误代码及解决

    def _shuffle_data(self):
        p = np.random.permutation(self._num_examples) #直接调用numoy的混排函数
        self._data = self._data(p)
        self._labels = self._labels(p)

错误在于用了圆括号,应该改为方括号

如下

    def _shuffle_data(self):
        p = np.random.permutation(self._num_examples) #直接调用numoy的混排函数
        self._data = self._data[p]
        self._labels = self._labels[p]
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐