Calculation of cross_entropy loss function of torch (including python code)
1. Call
Firstly, the cross entropy loss function of torch is called as follows:
torch.nn.functional.cross_entropy(input, target, weight=None, size_average=None, ignore_index=-100, reduce=None, reduction='mean')
It is usually written as:
import torch.nn.functional as F
F.cross_entropy(input, target)
2. Parameter description
Input( tensor ...
Posted by wilhud on Wed, 01 Dec 2021 00:39:19 -0800