Hi,
I am new to PyTorch Lightning and I cannot understand following parts in “Forward vs training_step” section in style guide:
We recommend using forward for inference/predictions and keeping training_step independent
def forward(...): embeddings = self.encoder(x) def training_step(...): x, y = ... z = self.encoder(x) pred = self.decoder(z) ...
Isn’t single source of truth a virtue in programing? Why don’t you recommend reusing forward()
in the training_step()
?