Spaces:
Sleeping
Sleeping
add softmax
#3
by
skhatuya
- opened
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import torch
|
|
| 4 |
from torch import nn
|
| 5 |
import numpy as np
|
| 6 |
from PIL import Image
|
|
|
|
| 7 |
|
| 8 |
# Creating Neural Model class used for training and validation
|
| 9 |
class NeuralNetwork(nn.Module):
|
|
@@ -21,6 +22,7 @@ class NeuralNetwork(nn.Module):
|
|
| 21 |
def forward(self, x):
|
| 22 |
x = self.flatten(x)
|
| 23 |
logits = self.linear_relu_stack(x)
|
|
|
|
| 24 |
return logits
|
| 25 |
|
| 26 |
# Intializing and loading the saved model
|
|
|
|
| 4 |
from torch import nn
|
| 5 |
import numpy as np
|
| 6 |
from PIL import Image
|
| 7 |
+
import torch.nn.functional as F
|
| 8 |
|
| 9 |
# Creating Neural Model class used for training and validation
|
| 10 |
class NeuralNetwork(nn.Module):
|
|
|
|
| 22 |
def forward(self, x):
|
| 23 |
x = self.flatten(x)
|
| 24 |
logits = self.linear_relu_stack(x)
|
| 25 |
+
logits = F.log_softmax(logits, dim=1)
|
| 26 |
return logits
|
| 27 |
|
| 28 |
# Intializing and loading the saved model
|