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

change backbone to self #8762

Merged
merged 1 commit into from
Aug 6, 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
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