Basic losses used in keratorch
e = torch.arange(-3, 3, 0.1)
plt.plot(e, [mse_loss(e_, torch.zeros_like(e_)) for e_ in e]);
e = torch.arange(-3, 3, 0.1)
plt.plot(e, [mae(e_, torch.zeros_like(e_)) for e_ in e]);
e = torch.arange(-3, 3, 0.1)
print('Red dot shows the loss when probability is zero and the true target is zero.')
plt.plot(torch.sigmoid(e), [bce(torch.sigmoid(e_), torch.zeros_like(e_)) for e_ in e])
plt.scatter(0, 0, c='r')
plt.xlabel('calculated probability')
plt.ylabel('loss')
plt.show()