Hi,
I read the tutorial code of tree-lstm. While I get confused if the code keeps consistent with the original formular.
g.ndata['iou'] = self.cell.W_iou((embeds)) * batch.mask.float().unsqueeze(-1)
is called outside, but the value seems not be passed to the message passing, the iou = nodes.data['iou'] + self.b_iou
only contains U_iou(h_cat) + b_iou
, where is W_iou(x_z)
?
I also have another question. In self.U_f = nn.Linear(2 * [h_size], 2 * [h_size])
why the output dimension is not 3 * [h_size])
, and what is the dimension of nodes.mailbox['h'].size()
? It seems the dimension of the element-wise multiplication for the following is not same.
f = th.sigmoid(self.U_f(h_cat)).view(*nodes.mailbox['h'].size())
c = th.sum(f * nodes.mailbox['c'], 1)
Thanks for your help.
The tutorial link:
https://docs.dgl.ai/en/0.6.x/tutorials/models/2_small_graph/3_tree-lstm.html