It is not a bug. Currently, by default the shape of a shared variable can changes during the execution. So we can't use the shape to determine the broadcasting pattern.
You can pass the parameter broadcastable=() where you put the broadcast pattern. By default it is never broadcastable. Fred On ven. 25 août 2017 00:58 佐藤優 <sayu...@gmail.com> wrote: > I saw follown defferences: > import theano > import theano.tensor as T > import numpy as np > > o = np.ones((1,2,3)) > o2 = np.ones((2,1)) > o2_shared = theano.shared(ones((2, 1))) > > print((o2 + o).shape) > print((o2_shared + o).shape) > > result is > > (1, 2, 3) > [1 2 1] > > > Maybe, broadcasting result is difference. > > But changing the order of calculation: > import theano > import theano.tensor as T > import numpy as np > > > o = np.ones((1,2,3)) > o2 = np.ones((2,1)) > o2_shared = theano.shared(ones((2, 1))) > > print((o + o2).shape) > print((o + o2_shared).shape.eval()) > > > > result is same as follows: > > (1, 2, 3) > [1 2 3] > > > Is this theano.shared bug? > > -- > > --- > You received this message because you are subscribed to the Google Groups > "theano-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to theano-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.