berniwal/swin-transformer-pytorch

Runtime error

Closed this issue · 1 comments

I'm running an error in your code at line 117
dots += self.pos_embedding[self.relative_indices[:, :, 0], self.relative_indices[:, :, 1]]
IndexError: tensors used as indices must be long, byte or bool tensors

Thank you for reporting the error, it seems that the error occurs for some and upgrading to different numpy version or changing to [self.relative_indices[:, :, 0].type(torch.long), self.relative_indices[:, :, 1].type(torch.long)] solves the issue.

Unfortunately, I could not reproduce the error on my machine therefore it would be useful to know how did you resolve the error in your case and could you tell me more about your configuration, what operating system you use, what numpy, torch and python versions you are using?