随记·手撕coding | softmax & cross entropy

⭐ softmax:

随记·手撕coding | softmax & cross entropy_第1张图片

⭐ cross entropy:

随记·手撕coding | softmax & cross entropy_第2张图片

import numpy as np

def softmax(x):
    # x.shape: (nums, dim)
    expx = np.exp(x-np.max

你可能感兴趣的:(算法岗面试,softmax,cross-entropy,nlp,ml,ai)