Skip to content

Commit

Permalink
Tree ops to CPU (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhouad authored and yuhaozhang committed May 28, 2019
1 parent e574f4d commit db7c128
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions model/gcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def forward(self, inputs):
maxlen = max(l)

def inputs_to_tree_reps(head, words, l, prune, subj_pos, obj_pos):
head, words, subj_pos, obj_pos = head.cpu().numpy(), words.cpu().numpy(), subj_pos.cpu().numpy(), obj_pos.cpu().numpy()
trees = [head_to_tree(head[i], words[i], l[i], prune, subj_pos[i], obj_pos[i]) for i in range(len(l))]
adj = [tree_to_adj(maxlen, tree, directed=False, self_loop=False).reshape(1, maxlen, maxlen) for tree in trees]
adj = np.concatenate(adj, axis=0)
Expand Down

0 comments on commit db7c128

Please sign in to comment.