{"id":1776,"date":"2025-02-14T16:40:34","date_gmt":"2025-02-14T08:40:34","guid":{"rendered":"https:\/\/www.forillusion.com\/?p=1776"},"modified":"2025-02-14T16:40:35","modified_gmt":"2025-02-14T08:40:35","slug":"3-15-numerical-stability-and-init","status":"publish","type":"post","link":"https:\/\/www.forillusion.com\/index.php\/3-15-numerical-stability-and-init\/","title":{"rendered":"3.15 \u6570\u503c\u7a33\u5b9a\u6027\u548c\u6a21\u578b\u521d\u59cb\u5316"},"content":{"rendered":"\n<p><div class=\"has-toc have-toc\"><\/div><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8870\u51cf\u548c\u7206\u70b8<\/h2>\n\n\n\n<p>\u5f53\u795e\u7ecf\u7f51\u7edc\u7684\u5c42\u6570\u8f83\u591a\u65f6\uff0c\u6a21\u578b\u7684\u6570\u503c\u7a33\u5b9a\u6027\u5bb9\u6613\u53d8\u5dee\u3002\u4e0d\u8003\u8651\u504f\u5dee\u53c2\u6570\uff0c\u4e14\u8bbe\u6240\u6709\u9690\u85cf\u5c42\u7684\u6fc0\u6d3b\u51fd\u6570\u4e3a\u6052\u7b49\u6620\u5c04\uff08identity mapping\uff09$\\phi(x) = x$\u3002\u7ed9\u5b9a\u8f93\u5165$\\boldsymbol{X}$\uff0c\u591a\u5c42\u611f\u77e5\u673a\u7684\u7b2c$l$\u5c42\u7684\u8f93\u51fa$\\boldsymbol{H}^{(l)} = \\boldsymbol{X} \\boldsymbol{W}^{(1)} \\boldsymbol{W}^{(2)} \\ldots \\boldsymbol{W}^{(l)}$\u3002\u6b64\u65f6\uff0c\u5982\u679c\u5c42\u6570$l$\u8f83\u5927\uff0c$\\boldsymbol{H}^{(l)}$\u7684\u8ba1\u7b97\u53ef\u80fd\u4f1a\u51fa\u73b0\u8870\u51cf\u6216\u7206\u70b8\u3002\u5047\u8bbe\u8f93\u5165\u548c\u6240\u6709\u5c42\u7684\u6743\u91cd\u53c2\u6570\u90fd\u662f\u6807\u91cf\uff0c\u5982\u6743\u91cd\u53c2\u6570\u4e3a0.2\u548c5\uff0c\u591a\u5c42\u611f\u77e5\u673a\u7684\u7b2c30\u5c42\u8f93\u51fa\u4e3a\u8f93\u5165$\\boldsymbol{X}$\u5206\u522b\u4e0e$0.2^{30} \\approx 1 \\times 10^{-21}$\uff08\u8870\u51cf\uff09\u548c$5^{30} \\approx 9 \\times 10^{20}$\uff08\u7206\u70b8\uff09\u7684\u4e58\u79ef\u3002\u7c7b\u4f3c\u5730\uff0c\u5f53\u5c42\u6570\u8f83\u591a\u65f6\uff0c\u68af\u5ea6\u7684\u8ba1\u7b97\u4e5f\u66f4\u5bb9\u6613\u51fa\u73b0\u8870\u51cf\u6216\u7206\u70b8\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u968f\u673a\u521d\u59cb\u5316\u6a21\u578b\u53c2\u6570<\/h2>\n\n\n\n<p>\u56de\u987e3.8\u8282\u63cf\u8ff0\u7684\u591a\u5c42\u611f\u77e5\u673a\u3002\u4e3a\u4e86\u65b9\u4fbf\u89e3\u91ca\uff0c\u5047\u8bbe\u8f93\u51fa\u5c42\u53ea\u4fdd\u7559\u4e00\u4e2a\u8f93\u51fa\u5355\u5143$o_1$\uff0c\u4e14\u9690\u85cf\u5c42\u4f7f\u7528\u76f8\u540c\u7684\u6fc0\u6d3b\u51fd\u6570\u3002\u5982\u679c\u5c06\u6bcf\u4e2a\u9690\u85cf\u5355\u5143\u7684\u53c2\u6570\u90fd\u521d\u59cb\u5316\u4e3a\u76f8\u7b49\u7684\u503c\uff0c\u90a3\u4e48\u5728\u6b63\u5411\u4f20\u64ad\u65f6\u6bcf\u4e2a\u9690\u85cf\u5355\u5143\u5c06\u6839\u636e\u76f8\u540c\u7684\u8f93\u5165\u8ba1\u7b97\u51fa\u76f8\u540c\u7684\u503c\uff0c\u5e76\u4f20\u9012\u81f3\u8f93\u51fa\u5c42\u3002\u5728\u53cd\u5411\u4f20\u64ad\u4e2d\uff0c\u6bcf\u4e2a\u9690\u85cf\u5355\u5143\u7684\u53c2\u6570\u68af\u5ea6\u503c\u76f8\u7b49\u3002\u56e0\u6b64\uff0c\u8fd9\u4e9b\u53c2\u6570\u5728\u4f7f\u7528\u57fa\u4e8e\u68af\u5ea6\u7684\u4f18\u5316\u7b97\u6cd5\u8fed\u4ee3\u540e\u503c\u4f9d\u7136\u76f8\u7b49\u3002\u4e4b\u540e\u7684\u8fed\u4ee3\u4e5f\u662f\u5982\u6b64\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u65e0\u8bba\u9690\u85cf\u5355\u5143\u6709\u591a\u5c11\uff0c\u9690\u85cf\u5c42\u672c\u8d28\u4e0a\u53ea\u67091\u4e2a\u9690\u85cf\u5355\u5143\u5728\u53d1\u6325\u4f5c\u7528\u3002\u56e0\u6b64\u901a\u5e38\u5c06\u795e\u7ecf\u7f51\u7edc\u7684\u6a21\u578b\u53c2\u6570\uff0c\u7279\u522b\u662f\u6743\u91cd\u53c2\u6570\uff0c\u8fdb\u884c\u968f\u673a\u521d\u59cb\u5316\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">PyTorch\u7684\u9ed8\u8ba4\u968f\u673a\u521d\u59cb\u5316<\/h3>\n\n\n\n<p>\u968f\u673a\u521d\u59cb\u5316\u6a21\u578b\u53c2\u6570\u7684\u65b9\u6cd5\u6709\u5f88\u591a\u3002\u57283.3\u8282\u4e2d\uff0c\u4f7f\u7528<code>torch.nn.init.normal_()<\/code>\u4f7f\u6a21\u578b<code>net<\/code>\u7684\u6743\u91cd\u53c2\u6570\u91c7\u7528\u6b63\u6001\u5206\u5e03\u7684\u968f\u673a\u521d\u59cb\u5316\u65b9\u5f0f\u3002\u4e0d\u8fc7\uff0cPyTorch\u4e2d<code>nn.Module<\/code>\u7684\u6a21\u5757\u53c2\u6570\u90fd\u91c7\u53d6\u4e86\u8f83\u4e3a\u5408\u7406\u7684\u521d\u59cb\u5316\u7b56\u7565\uff0c\u56e0\u6b64\u4e00\u822c\u4e0d\u7528\u6211\u4eec\u8003\u8651\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Xavier\u968f\u673a\u521d\u59cb\u5316<\/h3>\n\n\n\n<p>\u8fd8\u6709\u4e00\u79cd\u6bd4\u8f83\u5e38\u7528\u7684\u968f\u673a\u521d\u59cb\u5316\u65b9\u6cd5\u53eb\u4f5cXavier\u968f\u673a\u521d\u59cb\u5316\u3002<br>\u5047\u8bbe\u67d0\u5168\u8fde\u63a5\u5c42\u7684\u8f93\u5165\u4e2a\u6570\u4e3a$a$\uff0c\u8f93\u51fa\u4e2a\u6570\u4e3a$b$\uff0cXavier\u968f\u673a\u521d\u59cb\u5316\u5c06\u4f7f\u8be5\u5c42\u4e2d\u6743\u91cd\u53c2\u6570\u7684\u6bcf\u4e2a\u5143\u7d20\u90fd\u968f\u673a\u91c7\u6837\u4e8e\u5747\u5300\u5206\u5e03<\/p>\n\n\n\n<p>$$<br>U\\left(-\\sqrt{\\frac{6}{a+b}}, \\sqrt{\\frac{6}{a+b}}\\right).<br>$$<\/p>\n\n\n\n<p>\u5b83\u7684\u8bbe\u8ba1\u4e3b\u8981\u8003\u8651\u5230\uff0c\u6a21\u578b\u53c2\u6570\u521d\u59cb\u5316\u540e\uff0c\u6bcf\u5c42\u8f93\u51fa\u7684\u65b9\u5dee\u4e0d\u8be5\u53d7\u8be5\u5c42\u8f93\u5165\u4e2a\u6570\u5f71\u54cd\uff0c\u4e14\u6bcf\u5c42\u68af\u5ea6\u7684\u65b9\u5dee\u4e5f\u4e0d\u8be5\u53d7\u8be5\u5c42\u8f93\u51fa\u4e2a\u6570\u5f71\u54cd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8870\u51cf\u548c\u7206\u70b8 \u5f53\u795e\u7ecf\u7f51\u7edc\u7684\u5c42\u6570\u8f83\u591a\u65f6\uff0c\u6a21\u578b\u7684\u6570\u503c\u7a33\u5b9a\u6027\u5bb9\u6613\u53d8\u5dee\u3002\u4e0d\u8003\u8651\u504f\u5dee\u53c2\u6570\uff0c\u4e14\u8bbe\u6240\u6709\u9690\u85cf\u5c42\u7684\u6fc0\u6d3b\u51fd\u6570\u4e3a\u6052\u7b49\u6620\u5c04\uff08identity &#8230;<\/p>","protected":false},"author":1,"featured_media":1777,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46,3],"tags":[45,44,12,22],"class_list":["post-1776","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-46","category-3","tag-45","tag-44","tag-12","tag-22"],"_links":{"self":[{"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/posts\/1776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/comments?post=1776"}],"version-history":[{"count":1,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/posts\/1776\/revisions"}],"predecessor-version":[{"id":1778,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/posts\/1776\/revisions\/1778"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/media\/1777"}],"wp:attachment":[{"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/media?parent=1776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/categories?post=1776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/tags?post=1776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}