2016-06-09 75 views
1

对于下面的代码段:ValueError异常:NEW_ORDER [2]是1,但输入只有1轴

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. 

我没有看到问题恰恰在哪里。任何想法?

回答

0

你忘了告诉是什么参数(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)) 
相关问题