Skip to content

Commit

Permalink
change backbone to self (#8762)
Browse files Browse the repository at this point in the history
No need to use backbone. Calling self proceeds forward.
  • Loading branch information
HansolEom authored Aug 6, 2021
1 parent 0b7f6d9 commit 69f287e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pl_examples/basic_examples/backbone_image_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,26 @@ def forward(self, x):

def training_step(self, batch, batch_idx):
x, y = batch
y_hat = self.backbone(x)
y_hat = self(x)
loss = F.cross_entropy(y_hat, y)
self.log("train_loss", loss, on_epoch=True)
return loss

def validation_step(self, batch, batch_idx):
x, y = batch
y_hat = self.backbone(x)
y_hat = self(x)
loss = F.cross_entropy(y_hat, y)
self.log("valid_loss", loss, on_step=True)

def test_step(self, batch, batch_idx):
x, y = batch
y_hat = self.backbone(x)
y_hat = self(x)
loss = F.cross_entropy(y_hat, y)
self.log("test_loss", loss)

def predict_step(self, batch, batch_idx, dataloader_idx=None):
x, y = batch
return self.backbone(x)
return self(x)

def configure_optimizers(self):
# self.hparams available because we called self.save_hyperparameters()
Expand Down

0 comments on commit 69f287e

Please sign in to comment.