minor fixes

This commit is contained in:
Fangjun Kuang 2023-06-06 15:30:14 +08:00
parent 9c888b4b66
commit 26f3049f4c

View File

@ -1321,8 +1321,6 @@ class CompactRelPositionalEncoding(torch.nn.Module):
# self.pe contains both positive and negative parts # self.pe contains both positive and negative parts
# the length of self.pe is 2 * input_len - 1 # the length of self.pe is 2 * input_len - 1
if self.pe.size(0) >= T * 2 - 1: if self.pe.size(0) >= T * 2 - 1:
# Note: TorchScript doesn't implement operator== for torch.Device
# if self.pe.dtype != x.dtype or self.pe.device != x.device:
self.pe = self.pe.to(dtype=x.dtype, device=x.device) self.pe = self.pe.to(dtype=x.dtype, device=x.device)
return return