step = 0
batch_size = 128
iters = 2618730
while step * batch_size < iters:
batch_x = train_data[(step * batch_size):((step+1) * batch_size)]
batch_y = labels[(step * batch_size):((step+1) * batch_size)]
sess.run(optimizer, feed_dict={x: batch_x, y: batch_y keep_prob: dropout})
在上面的代码段中,我试图以128的批次访问133 x 229498(以字典形式)的train_data,但是它抛出以下错误
batch_x = train_data[(step * size):((step+1) * size)]
TypeError: unhashable type: 'slice'
我正在使用Python 3.6