Why are the dimensions of lookup_parameters flipped?

33 views
Skip to first unread message

Xiang Yu

unread,
Apr 18, 2018, 9:53:48 AM4/18/18
to DyNet Users
Hi,

I'm wondering why are the dimensions of lookup_parameters not consistent with normal parameters?

For example:
    m = dy.Model()
    p = m.add_lookup_parameters((2,3))
    print p[0].value()  # get a vector of length 3
    print p.expr()[0].value() # get a vector of length 2

Cheers,
Xiang

Junjie Yang

unread,
Apr 24, 2018, 9:40:02 AM4/24/18
to DyNet Users
Hi,
For your example, p is of type LookupParameters. If you want to get the value of p, i recommend the use of method .as_array() instead of .expr() which is a method of type Parameters.
I hope that helps.

在 2018年4月18日星期三 UTC+8下午9:53:48,Xiang Yu写道:

Xiang Yu

unread,
Apr 25, 2018, 3:34:53 AM4/25/18
to DyNet Users
Hi Junjie, 

thanks for the explanation! Do you also know is there any difference in terms of efficiency between these two methods?
Reply all
Reply to author
Forward
0 new messages