Skip to content

Shows error RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got CPUIntTensor instead (while checking arguments for embedding) while running train_transe_model.py script #2

@ghost

Description

Traceback (most recent call last):
File "train_transe_model.py", line 145, in
main()
File "train_transe_model.py", line 140, in main
train(args)
File "train_transe_model.py", line 45, in train
train_loss = model(batch_idxs)
File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "C:\Users\hp\fld\transe_model.py", line 99, in forward
loss = self.compute_loss(batch_idxs)
File "C:\Users\hp\fld\transe_model.py", line 119, in compute_loss
up_loss, up_embeds = self.neg_loss('user', 'purchase', 'product', user_idxs, product_idxs)
File "C:\Users\hp\fld\transe_model.py", line 188, in neg_loss
relation_vec, relation_bias_embedding, self.num_neg_samples, entity_tail_distrib)
File "C:\Users\hp\fld\transe_model.py", line 209, in kg_neg_loss
entity_head_vec = entity_head_embed(entity_head_idxs) # [batch_size, embed_size]
File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\modules\sparse.py", line 108, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "C:\Users\hp\Anaconda3\lib\site-packages\torch\nn\functional.py", line 1076, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got CPUIntTensor instead (while checking arguments for embedding)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions