{"title":"SoftmaxWithLoss","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhtn20190109.hatenablog.com%2Fentry%2F2025%2F08%2F18%2F231346\" title=\"SoftmaxWithLoss - HTN20190109\u306e\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","width":"100%","provider_url":"https://hatena.blog","url":"https://htn20190109.hatenablog.com/entry/2025/08/18/231346","version":"1.0","image_url":null,"author_url":"https://blog.hatena.ne.jp/HTN20190109/","published":"2025-08-18 23:13:46","blog_url":"https://htn20190109.hatenablog.com/","description":"python3.11 import numpy as np def softmax(x): if x.ndim == 2: x = x - np.max(x,axis=1,keepdims=True) x = np.exp(x) / np.sum(np.exp(x),axis=1,keepdims=True) elif x.ndim == 1: x = x - np.max(x) x = np.exp(x) / np.sum(np.exp(x) ) return x def cross_entropy_error(y,t): if y.ndim == 1: t = t.reshape(1, t\u2026","categories":["DL"],"type":"rich","provider_name":"Hatena Blog","author_name":"HTN20190109","height":"190","blog_title":"HTN20190109\u306e\u65e5\u8a18"}