rename variables nb -> num (#567)

* rename nb -> num

* flake8

* batch_nb, epoch_nb, gpu_nb, split_nb

* add _num deprecations
This commit is contained in:
Jirka Borovec
2019-12-04 06:57:10 -05:00
committed by William Falcon
parent 63717e8fda
commit 3a58937d8b
30 changed files with 326 additions and 290 deletions
+3 -3
View File
@@ -90,12 +90,12 @@ class GAN(pl.LightningModule):
def adversarial_loss(self, y_hat, y):
return F.binary_cross_entropy(y_hat, y)
def training_step(self, batch, batch_nb, optimizer_i):
def training_step(self, batch, batch_idx, optimizer_idx):
imgs, _ = batch
self.last_imgs = imgs
# train generator
if optimizer_i == 0:
if optimizer_idx == 0:
# sample noise
z = torch.randn(imgs.shape[0], self.hparams.latent_dim)
@@ -125,7 +125,7 @@ class GAN(pl.LightningModule):
return output
# train discriminator
if optimizer_i == 1:
if optimizer_idx == 1:
# Measure discriminator's ability to classify real from generated samples
# how well can it label as real?
@@ -234,7 +234,7 @@ def main(hparams):
trainer = pl.Trainer(
default_save_path=hparams.save_path,
gpus=hparams.gpus,
max_nb_epochs=hparams.epochs,
max_num_epochs=hparams.epochs,
distributed_backend=hparams.distributed_backend,
use_amp=hparams.use_16bit
)
@@ -31,7 +31,7 @@ def main(hparams):
# ------------------------
trainer = Trainer(
gpus=2,
nb_gpu_nodes=2,
num_nodes=2,
distributed_backend='ddp2'
)
@@ -31,7 +31,7 @@ def main(hparams):
# ------------------------
trainer = Trainer(
gpus=2,
nb_gpu_nodes=2,
num_nodes=2,
distributed_backend='ddp'
)