AStarNet icon indicating copy to clipboard operation
AStarNet copied to clipboard

RuntimeError: shape mismatch: value tensor of shape [24, 0] cannot be broadcast to indexing result of shape [24, 10]

Open Linawdjn opened this issue 1 year ago • 0 comments

Traceback (most recent call last): File "/home/nudt/linyawei/AStarNet/script/visualize.py", line 175, in visualize(solver, solver.test_set[i], entity_vocab, relation_vocab, output_file="/home/nudt/linyawei/AStarNet/results.txt") File "/home/nudt/linyawei/AStarNet/script/visualize.py", line 112, in visualize paths, weights, num_steps = solver.model.visualize(vis_batch) File "/home/nudt/anaconda3/envs/astar/lib/python3.10/site-packages/torchdrug-0.2.1-py3.10.egg/torchdrug/tasks/reasoning.py", line 222, in visualize return self.model.visualize(self.fact_graph, h_index, t_index, r_index) File "/home/nudt/linyawei/AStarNet/reasoning/model.py", line 404, in visualize lengths, source_indexes = self.beam_search_length(graph, subgraphs, graph.num_node, h_index, t_index) File "/home/nudt/linyawei/AStarNet/reasoning/model.py", line 449, in beam_search_length length[node_out] = sub_length[out_mask] File "/home/nudt/linyawei/AStarNet/reasoning/data.py", line 81, in setitem new_values[inverse[len(self.keys):]] = values RuntimeError: shape mismatch: value tensor of shape [24, 0] cannot be broadcast to indexing result of shape [24, 10] I have encountered this problem on visualize.py, how do I solve it?

Linawdjn avatar Dec 03 '24 07:12 Linawdjn