ValueError: new_order[2] is 1, but the input only has 1 axes

ValueError: new_order[2] is 1, but the input only has 1 axes

对于下面的一段代码:

imgs = theano.shared(numpy.asarray(numpy.random.uniform((batch_size,c,n1,n2)),dtype=theano.config.floatX))
imgs = imgs.dimshuffle((0,'x', 1, 2, 3))

我收到以下错误:

ValueError: new_order[2] is 1, but the input only has 1 axes.

我看不出问题到底出在哪里。有什么想法吗?

你忘了说参数是什么(batch_size,c,n1,n2)

imgs = theano.shared(numpy.asarray(numpy.random.uniform(size=(batch_size,c,n1,n2)),dtype=theano.config.floatX))
imgs = imgs.dimshuffle((0,'x', 1, 2, 3))