Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open

Description

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /