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

6638 use np.prod instead of np.product #6639

Merged
merged 2 commits into from
Jun 22, 2023
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
2 changes: 1 addition & 1 deletion monai/networks/nets/regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _get_layer(
return layer

def _get_final_layer(self, in_shape: Sequence[int]):
linear = nn.Linear(int(np.product(in_shape)), int(np.product(self.out_shape)))
linear = nn.Linear(int(np.prod(in_shape)), int(np.prod(self.out_shape)))
return nn.Sequential(nn.Flatten(), linear)

def forward(self, x: torch.Tensor) -> torch.Tensor:
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/nets/varautoencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __init__(
for s in strides:
self.final_size = calculate_out_shape(self.final_size, self.kernel_size, s, padding) # type: ignore

linear_size = int(np.product(self.final_size)) * self.encoded_channels
linear_size = int(np.prod(self.final_size)) * self.encoded_channels
self.mu = nn.Linear(linear_size, self.latent_size)
self.logvar = nn.Linear(linear_size, self.latent_size)
self.decodeL = nn.Linear(self.latent_size, linear_size)
Expand Down