数组索引太多

时间:2017-11-29 17:34:35

标签: python python-2.7 machine-learning tensorflow deep-learning

如何解决此问题?

def random_mini_batches(train_inputs, train_targets, mini_batch_size = 64, seed = 0):
    m = 17000              
    mini_batches = []
    np.random.seed(seed)

    permutation = list(np.random.permutation(m))
    shuffled_X = train_inputs[:, permutation]
    shuffled_Y = train_targets[:, permutation].reshape((10,m))

错误:

/home/kkkk/Desktop/ in random_mini_batches(X, Y, mini_batch_size, seed)

    m = 17000              
    mini_batches = []
    np.random.seed(seed)

         49     permutation = list(np.random.permutation(m))
    ---> 50     shuffled_X = train_inputs[:, permutation]
         51     shuffled_Y = train_targets[:, permutation].reshape((10,m))
         52 

    IndexError: too many indices for array

这与shuffled_X和shuffled_Y的维度有关吗?

0 个答案:

没有答案