Skip to content

Commit

Permalink
move frequency bands to linear space
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Oct 4, 2021
1 parent 144b0d9 commit 483a6ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions perceiver_pytorch/perceiver_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def fourier_encode(x, max_freq, num_bands = 4):
x = x.unsqueeze(-1)
device, dtype, orig_x = x.device, x.dtype, x

scales = torch.logspace(0., log(max_freq / 2) / log(10), num_bands, device = device, dtype = dtype)
scales = torch.linspace(1., max_freq / 2, num_bands, device = device, dtype = dtype)
scales = scales[(*((None,) * (len(x.shape) - 1)), Ellipsis)]

x = x * scales * pi
x = torch.cat([x.sin(), x.cos()], dim=-1)
x = torch.cat([x.sin(), x.cos()], dim = -1)
x = torch.cat((x, orig_x), dim = -1)
return x

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'perceiver-pytorch',
packages = find_packages(),
version = '0.7.3',
version = '0.7.4',
license='MIT',
description = 'Perceiver - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit 483a6ed

Please sign in to comment.