You need to use theano's dimshuffle to add a the "1" dimension to the 
vector then it will broadcast correctly.

out = v.dimshuffle(0, 'x') * B

where the "0" in dimshuffle represents the first (and only) axis of the 
vector and "'x'" represents a new broadcastable dimension of length 1.

On Tuesday, August 30, 2016 at 10:25:26 PM UTC-7, Haohan Wang wrote:
>
> Hi, 
>
> Is there any way in Theano that supports a vector broadcasting to a 
> matrix? The document does not indicate so, but I can hardly believe a tool 
> like theano does not support this.
>
> Basically, what I need is: 
>
>  a vector *v *of size n x 1, and a matrix *B *of size (n x m), and I hope 
> to take the product of *v* and *B* that returns the result as a (*n** x m*) 
> matrix, where each column *i *of the result is an element-wise product of 
> *v *and *B_i (1 < i < m)*
>
> Thanks. 
> Haohan
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to