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

Correct num_rows calculation in LatentDimInterpolator callback #573

Merged
merged 3 commits into from
Mar 9, 2021
Merged
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
4 changes: 1 addition & 3 deletions pl_bolts/callbacks/variational.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import math
from typing import List

import numpy as np
Expand Down Expand Up @@ -67,8 +66,7 @@ def on_epoch_end(self, trainer: Trainer, pl_module: LightningModule) -> None:
)
images = torch.cat(images, dim=0) # type: ignore[assignment]

num_images = (self.range_end - self.range_start)**2
num_rows = int(math.sqrt(num_images))
num_rows = self.steps
grid = torchvision.utils.make_grid(images, nrow=num_rows, normalize=self.normalize)
str_title = f'{pl_module.__class__.__name__}_latent_space'
trainer.logger.experiment.add_image(str_title, grid, global_step=trainer.global_step)
Expand Down