03_pytorch_computer_vision.ipynb crossEntropyLoss() #1031
Unanswered
rithvikshetty
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Yes, the activation function should be kept only between layers not outside the layers that is the case for every model architecture class FashionMNISTModelV1(nn.Module):
def __init__(self, input_shape: int, hidden_units: int, output_shape: int):
super().__init__()
self.layer_stack = nn.Sequential(
nn.Flatten(), # flatten inputs into single vector
nn.Linear(in_features=input_shape, out_features=hidden_units),
nn.ReLU(),
nn.Linear(in_features=hidden_units, out_features=output_shape),
)
def forward(self, x: torch.Tensor):
return self.layer_stack(x) |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Model used in the video for this was:
But, the CrossEntropy requires the input to be Logits and not the activated output right?
So, shouldn't we remove the ReLU from the last output layer?
Beta Was this translation helpful? Give feedback.
All reactions