AttributeError: ‘numpy.ndarray‘ object has no attribute ‘softmax‘

Softmax is a function in Python, so before using it, you need to change numpy.ndarray type to tensor type of torch 1. Ndarray – & gt; tensor
torch.from_ Numpy (ndarray type variable)
2; Ndarray
tensor type variable. Numpy ()

Read More: