This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# converting list of class weights to a tensor | |
weights= torch.tensor(class_weights,dtype=torch.float) | |
# push to GPU | |
weights = weights.to(device) | |
# define the loss function | |
cross_entropy = nn.NLLLoss(weight=weights) | |
# number of training epochs | |
epochs = 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment