RuntimeError: Trying to resize storage that is not resizable at

When i train the R-GCN model with my own dataset, the RuntimeError occurs:

RuntimeError Traceback (most recent call last)
in ()
78 print(“start eval”)
79 mrr = utils.evaluate(test_graph, model, valid_data, num_nodes,
—> 80 hits=[1, 3, 10], eval_bz=eval_batch_size)
81 # save best model
82 if mrr < best_mrr:

~/R-GCN/utils.py in evaluate(test_graph, model, test_triplets, num_entity, hits, eval_bz)
198 ranks_s = perturb_and_get_rank(embedding, w, o, r, s, num_entity, eval_bz)
199 # perturb object
–> 200 ranks_o = perturb_and_get_rank(embedding, w, s, r, o, num_entity, eval_bz)
201
202 ranks = torch.cat([ranks_s, ranks_o])

~/R-GCN/utils.py in perturb_and_get_rank(embedding, w, a, r, b, num_entity, batch_size)
183 score = torch.sigmoid(score)
184 target = b[batch_start: batch_end]
–> 185 ranks.append(sort_and_rank(score, target))
186 return torch.cat(ranks)
187

~/R-GCN/utils.py in sort_and_rank(score, target)
160 def sort_and_rank(score, target):
161 _, indices = torch.sort(score, dim=1, descending=True)
–> 162 indices = torch.nonzero(indices == target.view(-1, 1))
163 indices = indices[:, 1].view(-1)
164 return indices

RuntimeError: Trying to resize storage that is not resizable at /pytorch/aten/src/TH/THStorageFunctions.cpp:76

But it’s totally fine when using FB15k-237 datasets.

my datasets has the same format with FB15k-237, besides there is only one relationship in my dataset which is encoded : 0. i’m not sure if there any problem with my own datasets, or the codes.

I’ve never seen this error before. Could check the below issue to see whether it could fix your problem?
And also it would be better if you could print out the value and the type of target, which might help us to see where’s the problem.