Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Linawdjn opened this issue Dec 3, 2024 · 0 comments

Comments

@Linawdjn
Copy link

Linawdjn commented Dec 3, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant