berniwal/swin-transformer-pytorch

encounter error

Opened this issue · 2 comments

Hi, thank you so much for your code. But it encounter some error when implemented on my terminal. here is the error description follows
File "E:/Detection/swin/swin_transformer.py", line 117, in forward dots += self.pos_embedding[self.relative_indices[:, :, 0], self.relative_indices[:, :, 1]] IndexError: tensors used as indices must be long, byte or bool tensors
Your response will be highly apprecitaed.

Hi, this error has already occured for some in the past #7 #2 , I asumme it occurs for certain numpy/torch versions but you can fix it by replacing the line by [self.relative_indices[:, :, 0].type(torch.long), self.relative_indices[:, :, 1].type(torch.long)].

Nice , solve my problem.hhh