Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace np.product with np.prod #355

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions banding_removal/fastmri/data/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def create_input(shape):
input = np.arange(np.product(shape)).reshape(shape)
input = np.arange(np.prod(shape)).reshape(shape)
input = torch.from_numpy(input).float()
return input

Expand Down Expand Up @@ -179,7 +179,7 @@ def test_normalize_instance(shape):
[3, 4, 5],
])
def test_roll(shift, dim, shape):
input = np.arange(np.product(shape)).reshape(shape)
input = np.arange(np.prod(shape)).reshape(shape)
out_torch = transforms.roll(torch.from_numpy(input), shift, dim).numpy()
out_numpy = np.roll(input, shift, dim)
assert np.allclose(out_torch, out_numpy)
Expand All @@ -190,7 +190,7 @@ def test_roll(shift, dim, shape):
[2, 4, 6],
])
def test_fftshift(shape):
input = np.arange(np.product(shape)).reshape(shape)
input = np.arange(np.prod(shape)).reshape(shape)
out_torch = transforms.fftshift(torch.from_numpy(input)).numpy()
out_numpy = np.fft.fftshift(input)
assert np.allclose(out_torch, out_numpy)
Expand All @@ -202,7 +202,7 @@ def test_fftshift(shape):
[2, 7, 5],
])
def test_ifftshift(shape):
input = np.arange(np.product(shape)).reshape(shape)
input = np.arange(np.prod(shape)).reshape(shape)
out_torch = transforms.ifftshift(torch.from_numpy(input)).numpy()
out_numpy = np.fft.ifftshift(input)
assert np.allclose(out_torch, out_numpy)
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


def create_input(shape):
x = np.arange(np.product(shape)).reshape(shape)
x = np.arange(np.prod(shape)).reshape(shape)
x = torch.from_numpy(x).float()

return x
Expand Down
6 changes: 3 additions & 3 deletions tests/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_root_sum_of_squares(shape, dim):
],
)
def test_roll(shift, dim, shape):
x = np.arange(np.product(shape)).reshape(shape)
x = np.arange(np.prod(shape)).reshape(shape)
if isinstance(shift, int) and isinstance(dim, int):
torch_shift = [shift]
torch_dim = [dim]
Expand All @@ -132,7 +132,7 @@ def test_roll(shift, dim, shape):
],
)
def test_fftshift(shape):
x = np.arange(np.product(shape)).reshape(shape)
x = np.arange(np.prod(shape)).reshape(shape)
out_torch = fastmri.fftshift(torch.from_numpy(x)).numpy()
out_numpy = np.fft.fftshift(x)

Expand All @@ -148,7 +148,7 @@ def test_fftshift(shape):
],
)
def test_ifftshift(shape):
x = np.arange(np.product(shape)).reshape(shape)
x = np.arange(np.prod(shape)).reshape(shape)
out_torch = fastmri.ifftshift(torch.from_numpy(x)).numpy()
out_numpy = np.fft.ifftshift(x)

Expand Down
Loading