{"id":498360,"date":"2026-10-13T00:52:43","date_gmt":"2026-10-12T21:52:43","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=498360"},"modified":"2026-10-13T00:52:43","modified_gmt":"2026-10-12T21:52:43","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=498360","title":{"rendered":"\u041f\u043e\u0442\u0435\u0440\u044f\u043d\u043d\u0430\u044f \u0442\u0435\u0442\u0440\u0430\u0434\u044c \u2014 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u043b\u0438\u043d\u043d\u043e\u044e \u0432 \u043d\u043e\u0447\u044c"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0411\u044b\u043b \u043f\u043e\u0437\u0434\u043d\u0438\u0439 \u0432\u0435\u0447\u0435\u0440. \u0423\u0436\u0430\u0441\u043d\u043e \u0431\u043e\u043b\u0435\u043b\u0430 \u0433\u043e\u043b\u043e\u0432\u0430, \u043f\u0440\u043e\u0441\u0442\u0443\u0434\u0430 \u043d\u0435 \u0434\u0430\u0432\u0430\u043b\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u044b\u0448\u0430\u0442\u044c, \u0430 \u0433\u0440\u0430\u0434\u0443\u0441\u043d\u0438\u043a \u0443\u043f\u0440\u044f\u043c\u043e \u043f\u043e\u043b\u0437 \u0432\u0432\u0435\u0440\u0445. \u0427\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441\u0430\u043c\u0430 \u0421\u043c\u0435\u0440\u0442\u044c \u0443\u0436\u0435 \u043d\u0430\u0442\u0438\u0440\u0430\u0435\u0442 \u043b\u044b\u0436\u0438 \u0433\u0434\u0435-\u0442\u043e \u0440\u044f\u0434\u043e\u043c?<\/p>\n<p>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043d\u0438\u0447\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0433\u0440\u0443\u0434\u0443 \u0441\u043a\u043e\u043f\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u043b\u0435 \u0431\u0443\u043c\u0430\u0433 &#8212; \u043d\u0430\u0434\u043e \u0436\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a. \u0418 \u0442\u0443\u0442 \u0432\u0437\u0433\u043b\u044f\u0434 \u0437\u0430\u0446\u0435\u043f\u0438\u043b\u0441\u044f \u0437\u0430 \u0441\u0442\u0430\u0440\u0443\u044e \u0442\u0435\u0442\u0440\u0430\u0434\u044c \u0442\u043e\u0440\u0447\u0430\u0432\u0448\u0443\u044e \u0438\u0437-\u0437\u0430 \u0448\u043a\u0430\u0444\u0430. <\/p>\n<p>\u042f \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u043b \u0435\u0435, \u0438 \u0432\u0437\u0433\u043b\u044f\u0434 \u0437\u0430\u0446\u0435\u043f\u0438\u043b\u0441\u044f \u0437\u0430 \u0441\u0442\u0430\u0440\u044b\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u043c \u043f\u043e\u0437\u0436\u0435 \u0443\u0445\u043e\u0434\u0430 NVIDIA \u0438\u0437 \u0420\u043e\u0441\u0441\u0438\u0438, \u0433\u0434\u0435 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432\u0435\u0434\u0443\u0449\u0438\u043c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u043c \u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439, \u043d\u043e \u0443\u0435\u0437\u0436\u0430\u0442\u044c \u043d\u0435 \u0441\u0442\u0430\u043b. \u0410 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u043b, \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u044f\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0431\u044b \u0437\u0430\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0435 \u044f\u0434\u0440\u0430 \u0441\u0432\u0435\u0440\u0442\u043a\u0438 \u0431\u0435\u0437 \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u0438\u0445 \u0442\u0435\u043e\u0440\u0435\u043c, \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e, \u0434\u043b\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u044f\u0434\u0440\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<figure class=\"bordered full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/62\/29\/cb\/6229cb6abc2e63f33bce6c1e17cf2d3e.jpg\" alt=\"\u0422\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0431\u0440\u043e\u0441\u043e\u043a \u0438\u0437 \u0442\u0435\u0442\u0440\u0430\u0434\u0438 \u0441 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u043e\u0439 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u0433\u043e\u0440\u043b\u044b\u0448\u043a\u0430\" title=\"\u0422\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0431\u0440\u043e\u0441\u043e\u043a \u0438\u0437 \u0442\u0435\u0442\u0440\u0430\u0434\u0438 \u0441 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u043e\u0439 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u0433\u043e\u0440\u043b\u044b\u0448\u043a\u0430\" width=\"1280\" height=\"863\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/62\/29\/cb\/6229cb6abc2e63f33bce6c1e17cf2d3e.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/62\/29\/cb\/6229cb6abc2e63f33bce6c1e17cf2d3e.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0422\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0431\u0440\u043e\u0441\u043e\u043a \u0438\u0437 \u0442\u0435\u0442\u0440\u0430\u0434\u0438 \u0441 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u043e\u0439 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u0433\u043e\u0440\u043b\u044b\u0448\u043a\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0434\u0435\u044f \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0439: \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430?<\/p>\n<p>\u042f \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0437\u0430\u0434\u0430\u0447\u0438\u043b \u0441\u0432\u043e\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0418\u0418 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c: \u0430 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u0430 \u044d\u0442\u0438 \u0433\u043e\u0434\u044b \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435? \u0423\u0441\u043f\u043e\u043a\u0430\u0438\u0432\u0430\u044e\u0449\u0435\u0435 \u0448\u0443\u0440\u0448\u0430\u043d\u0438\u0435 \u0434\u0440\u043e\u0441\u0441\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 V100, \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e \u043e \u0442\u043e\u043c \u0447\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0448\u0435\u043b, \u0430 \u043f\u043e\u043c\u0430\u0440\u0433\u0438\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u043b\u043e \u0447\u0442\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430&#8230;  <\/p>\n<p>\u0412\u044b\u0441\u043a\u043e\u0447\u0438\u043b\u0430 \u043f\u0430\u0440\u0430 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 AlphaTensor \u043e\u0442 DeepMind \u0438 \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0440\u0430\u0431\u043e\u0442, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u0430\u0431\u043e \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u00ab\u0441\u0435\u0440\u0435\u0431\u0440\u044f\u043d\u043e\u0439 \u043f\u0443\u043b\u0435\u00bb. \u041d\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435 &#8212; \u043d\u0438 \u0443 \u043a\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u044f \u043d\u0435 \u0443\u0432\u0438\u0434\u0435\u043b \u0434\u0432\u0443\u0445 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0432\u0435\u0449\u0435\u0439: <strong>\u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/strong> \u0438 <strong>\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430<\/strong> \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e\u0434 <em>\u041b\u042e\u0411\u042b\u0415<\/em> \u0441\u0432\u0435\u0440\u0442\u043a\u0438 (\u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c Stride, Dilation \u0438 \u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0435\u0439), \u043d\u043e \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u043b \u0442\u043e\u0442 \u043a\u0440\u0443\u0442\u043e\u0439 \u043c\u0443\u0436\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0432\u0430\u043b\u0438 \u0428\u043c\u0443\u044d\u043b\u044c \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434.<\/p>\n<p>\u0413\u0435\u0448\u0442\u0430\u043b\u044c\u0442, \u0432\u0438\u0441\u0435\u0432\u0448\u0438\u0439 \u0432 \u0432\u043e\u0437\u0434\u0443\u0445\u0435 \u0433\u043e\u0434\u0430\u043c\u0438, \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b \u0441\u0440\u043e\u0447\u043d\u043e\u0439 \u0440\u0430\u0437\u0432\u044f\u0437\u043a\u0438&#8230;.<\/p>\n<p>\u0421\u043a\u0430\u0436\u0443 \u0447\u0435\u0441\u0442\u043d\u043e: \u044f \u043f\u0438\u0448\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043d\u0430 C++, CUDA \u0438 HDL (VHDL\/SystemVerilog). \u0412\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0431\u0435\u0437 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0443\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e. \u041d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0441\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u0443\u0440\u043e\u0432\u043d\u044f Python, \u0434\u0443\u043c\u0430\u044e, \u0431\u044b\u043b\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u043e &#8212; \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044f \u0431\u044b\u043b \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0418\u0418 \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u0442\u044c \u043c\u043d\u0435 \u043a\u0430\u0440\u043a\u0430\u0441 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u0440\u044f\u043c\u043e \u043f\u043e \u043c\u043e\u0435\u043c\u0443 \u0440\u0438\u0441\u0443\u043d\u043a\u0443 \u0438\u0437 \u0442\u0435\u0442\u0440\u0430\u0434\u0438 . \u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u043b\u0435\u0433\u043a\u043e &#8212; \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430-\u0442\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f.<\/p>\n<p>\u0414\u0432\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u044f (fc_D \u0438 fc_F) \u043a\u043e\u0434\u0438\u0440\u0443\u044e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 D \u0438 \u044f\u0434\u0440\u043e F \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u00ab\u0433\u043e\u0440\u043b\u044b\u0448\u043a\u043e\u00bb (inter_dim). \u0412 \u0433\u043e\u0440\u043b\u044b\u0448\u043a\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u200b. \u0422\u0440\u0435\u0442\u0438\u0439 \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (fc_C) \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0444\u043e\u0440\u043c\u0443 \u0432\u044b\u0445\u043e\u0434\u0430.<\/p>\n<pre><code class=\"python\">class WinogradFromSketch(nn.Module):    def __init__(self, in_shape, out_shape, kernel_shape, inter_dim):        super().__init__()        self.fc_D = nn.Linear(math.prod(in_shape), inter_dim, bias=False)        self.fc_F = nn.Linear(math.prod(kernel_shape), inter_dim, bias=False)        self.fc_C = nn.Linear(inter_dim, math.prod(out_shape), bias=False)    def forward(self, D, F_tensor):        out_D = self.fc_D(D.view(B, -1))        out_F = self.fc_F(F_tensor.view(B, -1))        return self.fc_C(out_D * out_F).view(B, 1, *out_shape)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u044f \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0446\u0438\u043a\u043b \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0433\u0434\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u00ab\u0438\u0441\u0442\u0438\u043d\u044b\u00bb \u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0443\u0436\u0438\u043b\u0430 \u0441\u0430\u043c\u0430 \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u0430\u044f \u0441\u0432\u0435\u0440\u0442\u043a\u0430 (F.conv1d, F.conv2d \u0438\u043b\u0438 F.conv3d), \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0436\u0430\u0442\u044c. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0430\u0442\u0447\u0438 D \u0438 F, \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0442 \u043d\u0438\u0445 \u0438\u0441\u0442\u0438\u043d\u043d\u0443\u044e \u0441\u0432\u0435\u0440\u0442\u043a\u0443 &#8212; \u0432\u043e\u0442 \u0432\u0430\u043c \u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0448\u0443\u043c\u043e\u043c.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0442\u044c \u043e\u0431\u043d\u0443\u043b\u044f\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0438 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u0445 (\u0432\u0435\u0434\u044c \u043c\u044b \u0438\u0449\u0435\u043c \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u043a\u0430\u043a \u0443 \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430), \u044f \u043f\u043e\u0432\u0435\u0441\u0438\u043b \u043d\u0430 \u0432\u0435\u0441\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 L1-\u0448\u0442\u0440\u0430\u0444 \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0443\u043d\u0438\u043d\u0433 \u043f\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0440\u043e\u0431\u0438:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"Loss=MSE(pred,target)+\u03bb\u22c5(\u2223WD\u2223+\u2223WF\u2223+\u2223WC\u2223)\" alt=\"Loss=MSE(pred,target)+\u03bb\u22c5(\u2223WD\u2223+\u2223WF\u2223+\u2223WC\u2223)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4\/43\/431\/431919357654f9e9be318a189557bd39.svg\" width=\"480\" height=\"18\" data-width=\"59.941\" data-height=\"2.262\" data-vertical-align=\"-0.566\" style=\"width: 59.941ex; height: 2.262ex; vertical-align: -0.566ex\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4\/43\/431\/431919357654f9e9be318a189557bd39.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4\/43\/431\/431919357654f9e9be318a189557bd39.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u041d\u0430\u0442\u0440\u0430\u0432\u0438\u043b Adam, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0443\u044e 1D-\u0441\u0432\u0435\u0440\u0442\u043a\u0443, \u043d\u0430\u0436\u0430\u043b Run \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0441\u044f \u0436\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0430\u043b\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438&#8230;<\/p>\n<p>\u0418 \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0432\u044b\u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u044f\u0441\u043d\u0430\u044f, \u0447\u0438\u0441\u0442\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430! \u041c\u043e\u044f \u0440\u0435\u0430\u043a\u0446\u0438\u044f \u0431\u044b\u043b\u0430: \u00ab<strong>\u0414\u0430 \u043b\u0430\u0434\u043d\u043e?!<\/strong>\u00bb, \u043a\u0430\u043a \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0443 \u043c\u043e\u0435\u0433\u043e \u043d\u0430\u043f\u0430\u0440\u043d\u0438\u043a\u0430 \u043f\u043e \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043a\u0435, \u043a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043e\u0442\u043d\u0438 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435, \u0438 \u043e\u043d\u0438 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441\u0442\u0440\u043e\u0433\u043e \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430.<\/p>\n<pre><code>--- Matrix fc_D (data) (shape: (4, 4)) ---Zero percentage (&lt; 0.08333333333333333): 37.5%[[  0.00   0.76   0.98   0.00] [  0.00   0.89  -0.70   0.00] [  0.66   0.33  -0.66   0.00] [  0.00   0.63   0.31  -0.62]]--- Matrix fc_F (kernel) (shape: (4, 3)) ---Zero percentage (&lt; 0.08333333333333333): 33.3%[[  0.48   0.62   0.80] [  0.84  -0.65   0.51] [  1.24   0.00   0.00] [  0.00   0.00  -1.18]]--- Matrix fc_C (output) (shape: (2, 4)) ---Zero percentage (&lt; 0.08333333333333333): 25.0%[[  0.80  -1.06   1.22   0.00] [  1.02   0.83   0.00   1.36]]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u0432\u0435\u0447\u0435\u0440 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0430\u043b \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u0435\u043c\u043d\u044b\u043c. \u0410 \u043a\u0442\u043e-\u0442\u043e \u0442\u0430\u043c \u0432 \u0442\u0435\u043c\u043d\u043e\u0442\u0435, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0442\u0438\u0445\u043e \u0441\u043d\u044f\u043b \u043b\u044b\u0436\u0438, \u043e\u0442\u043b\u043e\u0436\u0438\u043b \u043a\u043e\u0441\u0443 \u0438 \u043f\u043e\u0434\u0441\u0435\u043b \u043f\u043e\u0431\u043b\u0438\u0436\u0435&#8230;<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438 \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0441\u0445\u043e\u0434\u0438\u043b\u0441\u044f, \u043d\u043e \u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u0442\u043e\u0440\u043e\u043f\u043b\u0438\u0432\u043e. \u041c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u044f\u0432\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043f\u043e\u0434\u0437\u0430\u0442\u044b\u043b\u044c\u043d\u0438\u043a\u0438. \u041e\u0442\u043a\u0443\u0434\u0430 \u0438\u0445 \u0432\u0437\u044f\u0442\u044c? \u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0443 \u043d\u0430\u0441 \u0436\u0435 \u043f\u0440\u044f\u043c\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0443\u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443 &#8212; \u0442\u0435 \u0441\u0430\u043c\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0434\u0430\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<p>\u0410\u0433\u0430! \u0411\u0443\u0434\u0435\u043c \u043a\u043e\u043f\u0438\u0442\u044c \u044d\u0442\u0438 \u00ab\u0442\u044f\u0436\u0435\u043b\u044b\u0435\u00bb \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 (HardExampleBuffer) \u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u0441\u0435\u0442\u044c \u043f\u043e \u043d\u0438\u043c. \u0418 \u044d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e: \u043f\u043e \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u044f\u043c, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0441\u043a\u043e\u0447\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a!<\/p>\n<pre><code class=\"python\">class HardExampleBuffer:    def __init__(self, capacity=1024 * 8):        self.capacity = capacity        self.D_buffer = None        self.F_buffer = None    def add_examples(self, D, F_tensor, errors, top_k=32):        # \u041e\u0442\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u044b\u0435 \"\u0442\u044f\u0436\u0435\u043b\u044b\u0435\" \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c MSE        _, top_idx = torch.topk(errors, k=min(top_k, D.size(0)))        # ... \u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u044d\u0442\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u043a\u0430\u0436\u0434\u044b\u0435 \u043f\u0430\u0440\u0443 \u0448\u0430\u0433\u043e\u0432<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041d\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0435, \u0445\u043e\u0442\u044c \u0438 \u043e\u0447\u0435\u043d\u044c \u0442\u044f\u0436\u0435\u043b\u043e\u0439 \u043e\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b, \u0432\u044b\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0435\u0441\u0443\u0440\u0441 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 &#8212; \u0437\u0430 \u0441\u0447\u0435\u0442 Python \u0438 \u0434\u043e\u0437\u0432\u043e\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0431\u0435 \u043f\u043e\u0433\u043e\u0432\u043d\u043e\u043a\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u0418\u0418 &#8212; \u0447\u0435\u0442\u043a\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0447\u0438\u0441\u0435\u043b, \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e (<img decoding=\"async\" class=\"formula inline\" source=\"|w| &gt; 1\" alt=\"|w| &gt; 1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/39\/392\/39209a4e1a287f3e01a4456f76129f39.svg\" width=\"56\" height=\"18\" data-width=\"7.026\" data-height=\"2.26\" data-vertical-align=\"-0.564\" style=\"width: 7.026ex; height: 2.26ex; vertical-align: -0.564ex\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/39\/392\/39209a4e1a287f3e01a4456f76129f39.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3\/39\/392\/39209a4e1a287f3e01a4456f76129f39.svg 781w\" loading=\"lazy\" decode=\"async\"\/>).<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b (<img decoding=\"async\" class=\"formula inline\" source=\"W_D\" alt=\"W_D\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9\/94\/943\/943767da9b6c23b1b3c3fc7a6065db6b.svg\" width=\"29\" height=\"15\" data-width=\"3.648\" data-height=\"1.885\" data-vertical-align=\"-0.339\" style=\"width: 3.648ex; height: 1.885ex; vertical-align: -0.339ex\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9\/94\/943\/943767da9b6c23b1b3c3fc7a6065db6b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9\/94\/943\/943767da9b6c23b1b3c3fc7a6065db6b.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0438 <img decoding=\"async\" class=\"formula inline\" source=\"W_F\" alt=\"W_F\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1\/11\/11f\/11f217a7d66382c887170bd452cfdb14.svg\" width=\"28\" height=\"15\" data-width=\"3.522\" data-height=\"1.885\" data-vertical-align=\"-0.339\" style=\"width: 3.522ex; height: 1.885ex; vertical-align: -0.339ex\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1\/11\/11f\/11f217a7d66382c887170bd452cfdb14.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1\/11\/11f\/11f217a7d66382c887170bd452cfdb14.svg 781w\" loading=\"lazy\" decode=\"async\"\/>) \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 &#8212; \u043e\u043d\u0438 \u0436\u0438\u0432\u0443\u0442 \u0432 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"[-1, 1]\" alt=\"[-1, 1]\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7\/7d\/7de\/7dec1d46e68831c4eca28b020fcb1604.svg\" width=\"50\" height=\"18\" data-width=\"6.287\" data-height=\"2.262\" data-vertical-align=\"-0.566\" style=\"width: 6.287ex; height: 2.262ex; vertical-align: -0.566ex\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7\/7d\/7de\/7dec1d46e68831c4eca28b020fcb1604.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7\/7d\/7de\/7dec1d46e68831c4eca28b020fcb1604.svg 781w\" loading=\"lazy\" decode=\"async\"\/> (\u0441\u043e\u0441\u0442\u043e\u044f \u0438\u0437 <img decoding=\"async\" class=\"formula inline\" source=\"0, \\pm 1, \\pm 1\/2\" alt=\"0, \\pm 1, \\pm 1\/2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7\/7c\/7c4\/7c42fcfaf7666d192f62fcdeed359141.svg\" width=\"90\" height=\"18\" data-width=\"11.189\" data-height=\"2.262\" data-vertical-align=\"-0.566\" style=\"width: 11.189ex; height: 2.262ex; vertical-align: -0.566ex\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7\/7c\/7c4\/7c42fcfaf7666d192f62fcdeed359141.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7\/7c\/7c4\/7c42fcfaf7666d192f62fcdeed359141.svg 781w\" loading=\"lazy\" decode=\"async\"\/>). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0438\u0434\u0438\u0442 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 <img decoding=\"async\" class=\"formula inline\" source=\"W_C\" alt=\"W_C\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0\/0d\/0db\/0dbf709d2ed6159c5249672bd8daf4a8.svg\" width=\"28\" height=\"15\" data-width=\"3.539\" data-height=\"1.92\" data-vertical-align=\"-0.375\" style=\"width: 3.539ex; height: 1.92ex; vertical-align: -0.375ex\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0\/0d\/0db\/0dbf709d2ed6159c5249672bd8daf4a8.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0\/0d\/0db\/0dbf709d2ed6159c5249672bd8daf4a8.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0441\u0432\u0435\u0440\u0442\u043a\u0438 \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0432\u043e\u0439. \u0427\u0442\u043e \u0441 \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c? \u0414\u0430 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e &#8212; \u0432\u043d\u043e\u0441\u0438\u043c \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0438! \u0418 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a \u043e\u0442\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442.<\/p>\n<p>\u041d\u043e \u0435\u0441\u0442\u044c \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0439 \u043d\u044e\u0430\u043d\u0441: \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 <code>scale<\/code> \u0434\u043b\u044f \u0432\u0435\u0441\u043e\u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043f\u0440\u044f\u043c\u043e \u0441\u0440\u0430\u0437\u0443 &#8212; \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u043b\u044c\u0437\u044f&#8230;<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u0434\u0440\u0430\u0442\u044c <code>scale<\/code> \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0436\u0435 \u0448\u0430\u0433\u0430, \u043b\u0435\u043d\u0438\u0432\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0442\u0443\u0442 \u0436\u0435 \u043d\u0430\u0439\u0434\u0435\u0442 \u00ab\u0433\u0440\u044f\u0437\u043d\u043e\u0435\u00bb \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0431\u0435\u0441\u0442\u043e\u043b\u043a\u043e\u0432\u044b\u0439 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 (\u043d\u0443\u043b\u0435\u0439 \u043c\u044b \u0442\u0430\u043c \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u043c).<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0433\u043e\u043b\u043e\u0434\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u043d\u044c\u043e\u043d \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0434\u0435\u0440\u0436\u0438\u043c \u0432\u0435\u0441\u0430 \u043d\u0430 \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0434\u0438\u0435\u0442\u0435 (<img decoding=\"async\" class=\"formula inline\" source=\"scale = 1.0\" alt=\"scale = 1.0\" src=\"https:\/\/habrastorage.org\/extt\/2d\/fc\/e0\/2dfce0bf537c61cba4e5833c385f77d9.svg\" width=\"90\" height=\"15\" data-width=\"10.875\" data-height=\"1.756\" data-vertical-align=\"-0.186\" style=\"width: 10.875ex; height: 1.756ex; vertical-align: -0.186ex\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/extt\/2d\/fc\/e0\/2dfce0bf537c61cba4e5833c385f77d9.svg 780w,&#10;       https:\/\/habrastorage.org\/extt\/2d\/fc\/e0\/2dfce0bf537c61cba4e5833c385f77d9.svg 781w\" loading=\"lazy\" decode=\"async\"\/>) \u0438 \u043f\u043b\u0430\u0432\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u043c <code>scale<\/code> \u043e\u0442 <img decoding=\"async\" class=\"formula inline\" source=\"1.0\" alt=\"1.0\" src=\"https:\/\/habrastorage.org\/extt\/d1\/b1\/c9\/d1b1c9ed3a973124cef9168a9271281d.svg\" width=\"24\" height=\"13\" data-width=\"2.891\" data-height=\"1.557\" data-vertical-align=\"-0.05\" style=\"width: 2.891ex; height: 1.557ex; vertical-align: -0.05ex\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/extt\/d1\/b1\/c9\/d1b1c9ed3a973124cef9168a9271281d.svg 780w,&#10;       https:\/\/habrastorage.org\/extt\/d1\/b1\/c9\/d1b1c9ed3a973124cef9168a9271281d.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0434\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f!<\/p>\n<pre><code class=\"python\"># S-\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0439 \u0441\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u0433\u043e\u043d scale \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044fnew_scale = get_current_scale(step, steps, float(winograd_scale))if new_scale != model.scale:    with torch.no_grad():        # \u0418\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442 \u0432\u0435\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b MSE \u043d\u0435 \u0441\u043a\u0430\u043a\u0430\u043b \u043f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 scale        model.fc_C.weight.mul_(model.scale \/ new_scale)    model.scale = new_scale<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0438 \u0441\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u0435\u0441\u043e\u0432\u044b\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0432\u0441\u0451, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043e\u0447\u0435\u043d\u044c \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u0438 \u0434\u0430\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u0443 \u0434\u043b\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041d\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0437\u043d\u0430\u043d\u0438\u044f \u2014 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0441 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0434\u0443\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u044f\u0434\u0440\u0430\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439!<\/p>\n<p>\u0418 \u0442\u0443\u0442 \u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043e\u0434\u0438\u043d \u0444\u043e\u043a\u0443\u0441. \u0414\u0430\u0432\u043d\u043e \u044f \u043a\u0430\u043a-\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 (\u041c\u041d\u041a \/ Least Squares) \u0434\u043b\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u043f\u0440\u0438 \u0438\u0445 \u0444\u0440\u0430\u043a\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0436\u0430\u0442\u0438\u0438 \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u043b: \u0430 \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0432\u0437\u044f\u0442\u044c \u044d\u0442\u0438 \u043d\u0435\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438 \u043d\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0441 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0441\u0432\u0435\u0440\u0442\u043a\u0438?<\/p>\n<pre><code class=\"python\"># --- \u042f\u0434\u0440\u043e \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u043b\u044c\u0432\u0435\u0440\u0430 (SymPy + \u041c\u041d\u041a) ---def prove_winograd_exact(model, target_sym, monomials, max_denom=36):    WD_float, WF_float = model.fc_D.weight.numpy(), model.fc_F.weight.numpy()    # 1. \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0438 q \u0438 \u043a\u0432\u0430\u043d\u0442\u0443\u0435\u043c WD \u0438 WF \u043a \u0434\u0440\u043e\u0431\u044f\u043c Q    for q in range(1, max_denom + 1):        WD_exact = snap_to_sympy_rationals(WD_float, limit_denom=q)        WF_exact = snap_to_sympy_rationals(WF_float, limit_denom=q)        # 2. \u0410\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u0443\u044e WC \u0447\u0435\u0440\u0435\u0437 \u041c\u041d\u041a (Least Squares)        M_num = build_monomial_matrix(WD_exact, WF_exact, monomials)        WC_num, *_ = np.linalg.lstsq(M_num, Target_num.T, rcond=None)        WC_exact = snap_to_sympy_rationals(WC_num.T, limit_denom=max_denom)        # 3. \u0421\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432 \u043a\u043e\u043b\u044c\u0446\u0435 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u043e\u0432 SymPy        M_sym = sp.Matrix(build_symbolic_monomials(WD_exact, WF_exact))        residual = sp.expand(sp.Matrix(WC_exact) * M_sym.T - target_sym)        # 4. \u0415\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043c\u0430\u0442\u0440\u0438\u0446 \u0441\u0442\u0440\u043e\u0433\u043e \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u0439\u0434\u0435\u043d!        if residual == sp.zeros(*residual.shape):            print(f\"[\u0423\u0421\u041f\u0415\u0425] \u0422\u043e\u0447\u043d\u043e\u0435 \u0442\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043f\u0440\u0438 q = {q} (\u043e\u0448\u0438\u0431\u043a\u0430 = 0)!\")            return WD_exact, WF_exact, WC_exact, True    return None, None, None, False<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u043e\u043b\u0434\u0443\u043d\u0441\u0442\u0432\u0430 \u043d\u0430\u0434 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0443\u043c\u043a\u043e\u0439 &#8212; \u0443\u0436\u0435 \u043d\u0430 \u0437\u0430\u0440\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u043e\u043f\u044f\u0442\u044c: <em>\u00ab\u0414\u0430 \u043d\u0443 \u043d\u0430\u0444\u0438\u0433!\u00bb<\/em>. 100% \u043a\u043e\u043f\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430!<\/p>\n<pre><code>--- Symbolic Matrix fc_D (data) (shape: 4x4) ---[       0        1        1        0 ][       0        1       -1        0 ][       1        0       -1        0 ][       0        1        0       -1 ]Zero percentage: 50.0%--- Symbolic Matrix fc_F (kernel) (shape: 4x3) ---[       1        1        1 ][       1       -1        1 ][       1        0        0 ][       0        0       -1 ]Zero percentage: 33.3%--- Symbolic Matrix fc_C (output) (shape: 2x4) ---[     1\/2     -1\/2        1        0 ][     1\/2      1\/2        0        1 ]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u042f \u0437\u0430\u0432\u0430\u0440\u0438\u0432\u0430\u044e \u0431\u0435\u0441\u0441\u0447\u0435\u0442\u043d\u0443\u044e \u0447\u0430\u0448\u043a\u0443 \u0447\u0430\u044f \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u044f\u0434\u0440\u0430 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b \u0438 \u043d\u0435 \u0441\u043b\u044b\u0448\u0430\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u0444\u043e\u0440\u043c\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430 \u0438 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442! \u041c\u0435\u0442\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!<\/p>\n<pre><code>================================================================= Experiment Parameters (Winograd Algorithm Mining)=================================================================  Device                    : cuda  Data Type (dtype)         : torch.float32  Input Shape (in_shape)    : (5, 5) (25 elems)  Kernel Shape (kernel)     : (3, 3) (9 elems)  Output Shape (out_shape)  : (2, 2) (4 elems)  Stride &amp; Dilation         : stride=(2, 2), dilation=(1, 1)  -------------------------------------------------------------  Naive Multiplications     : 36  Winograd Multiplications  : 25  FLOPs Reduction           : +30.6%  -------------------------------------------------------------  Total Steps               : 100000  Batch Size                : 2048  Initial LR \/ L1 Lambda    : 0.001 \/ 0.00015  Pruning Threshold         : 0.000868  Max Denominator (q_max)   : 576  Target Scale (max scale)  : 36=================================================================step       1\/100000 | lr: 1.00e-03 | scale:  1.00 | mse: 8.838e+00 | l1 sum: 112.77step   10000\/100000 | lr: 9.76e-04 | scale:  1.00 | mse: 4.320e-06 | l1 sum: 171.90step   20000\/100000 | lr: 9.05e-04 | scale:  1.71 | mse: 1.602e-06 | l1 sum: 102.98step   30000\/100000 | lr: 7.94e-04 | scale:  7.04 | mse: 7.585e-06 | l1 sum: 66.34step   40000\/100000 | lr: 6.55e-04 | scale: 16.01 | mse: 3.799e-07 | l1 sum: 52.72step   50000\/100000 | lr: 5.01e-04 | scale: 25.77 | mse: 1.839e-07 | l1 sum: 45.42step   60000\/100000 | lr: 3.46e-04 | scale: 33.22 | mse: 7.071e-05 | l1 sum: 41.33step   70000\/100000 | lr: 2.07e-04 | scale: 36.00 | mse: 4.990e-07 | l1 sum: 38.97step   80000\/100000 | lr: 9.64e-05 | scale: 36.00 | mse: 1.407e-05 | l1 sum: 37.74step   90000\/100000 | lr: 2.54e-05 | scale: 36.00 | mse: 7.816e-08 | l1 sum: 36.77!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [SUCCESS]: Early stopping triggered at step 97000\/100000! Exact Winograd algorithm proved via SymPy (Residual = 0)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0427\u0442\u043e \u0436, \u043f\u043e\u0445\u043e\u0436\u0435, \u044f \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043b \u0434\u043b\u044f \u043f\u043b\u0430\u043d\u0435\u0442\u044b \u0433\u0438\u0433\u0430\u0432\u0430\u0442\u0442\u044b \u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0432 \u0433\u043e\u0434. \u0421\u043d\u043e\u0432\u0430 &#8212; \u043a\u0430\u043a \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u0438 \u0441\u043b\u0438\u0442\u044b\u043c\u0438 \u0441\u0432\u0435\u0440\u0442\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a \u0438 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0432 \u043d\u0435\u0434\u0440\u0430\u0445 \u043f\u0440\u043e\u043f\u0440\u0438\u0435\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 NVIDIA. \u041d\u043e \u043d\u0435 \u0441\u0435\u0433\u043e\u0434\u043d\u044f. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0430\u0447\u0435.  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u044f \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u043e\u0434 MIT \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439, \u043a\u0442\u043e-\u0442\u043e \u0432 \u0442\u0435\u043c\u043d\u043e\u0442\u0435 \u043a\u043b\u0430\u0446\u0430\u043b \u043f\u043e \u043a\u043b\u0430\u0432\u0438\u0448\u0430\u043c \u0438 \u0447\u0442\u043e-\u0442\u043e \u0431\u0443\u0431\u043d\u0438\u043b \u0441\u0435\u0431\u0435 \u043f\u043e\u0434 \u043d\u043e\u0441. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u044f \u0437\u0430\u043b\u0438\u043b \u0432\u0441\u0435 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/MaxAkaAltmer\/apex_winograd\" rel=\"noopener nofollow\">https:\/\/github.com\/MaxAkaAltmer\/apex_winograd<\/a> \u0438 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0443\u0441\u043d\u0443\u043b&#8230;<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/3d\/2a\/10\/3d2a10873ecbc3495ee9060cdac30b50.png\" width=\"1536\" height=\"856\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/3d\/2a\/10\/3d2a10873ecbc3495ee9060cdac30b50.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/3d\/2a\/10\/3d2a10873ecbc3495ee9060cdac30b50.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1093580\/\">https:\/\/habr.com\/ru\/articles\/1093580\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0411\u044b\u043b \u043f\u043e\u0437\u0434\u043d\u0438\u0439 \u0432\u0435\u0447\u0435\u0440. \u0423\u0436\u0430\u0441\u043d\u043e \u0431\u043e\u043b\u0435\u043b\u0430 \u0433\u043e\u043b\u043e\u0432\u0430, \u043f\u0440\u043e\u0441\u0442\u0443\u0434\u0430 \u043d\u0435 \u0434\u0430\u0432\u0430\u043b\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u044b\u0448\u0430\u0442\u044c, \u0430 \u0433\u0440\u0430\u0434\u0443\u0441\u043d\u0438\u043a \u0443\u043f\u0440\u044f\u043c\u043e \u043f\u043e\u043b\u0437 \u0432\u0432\u0435\u0440\u0445. \u0427\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441\u0430\u043c\u0430 \u0421\u043c\u0435\u0440\u0442\u044c \u0443\u0436\u0435 \u043d\u0430\u0442\u0438\u0440\u0430\u0435\u0442 \u043b\u044b\u0436\u0438 \u0433\u0434\u0435-\u0442\u043e \u0440\u044f\u0434\u043e\u043c?\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043d\u0438\u0447\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0433\u0440\u0443\u0434\u0443 \u0441\u043a\u043e\u043f\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u043b\u0435 \u0431\u0443\u043c\u0430\u0433 &#8212; \u043d\u0430\u0434\u043e \u0436\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a. \u0418 \u0442\u0443\u0442 \u0432\u0437\u0433\u043b\u044f\u0434 \u0437\u0430\u0446\u0435\u043f\u0438\u043b\u0441\u044f \u0437\u0430 \u0441\u0442\u0430\u0440\u0443\u044e \u0442\u0435\u0442\u0440\u0430\u0434\u044c \u0442\u043e\u0440\u0447\u0430\u0432\u0448\u0443\u044e \u0438\u0437-\u0437\u0430 \u0448\u043a\u0430\u0444\u0430. \u042f \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u043b \u0435\u0435, \u0438 \u0432\u0437\u0433\u043b\u044f\u0434 \u0437\u0430\u0446\u0435\u043f\u0438\u043b\u0441\u044f \u0437\u0430 \u0441\u0442\u0430\u0440\u044b\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u043c \u043f\u043e\u0437\u0436\u0435 \u0443\u0445\u043e\u0434\u0430 NVIDIA \u0438\u0437 \u0420\u043e\u0441\u0441\u0438\u0438, \u0433\u0434\u0435 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432\u0435\u0434\u0443\u0449\u0438\u043c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u043c \u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439, \u043d\u043e \u0443\u0435\u0437\u0436\u0430\u0442\u044c \u043d\u0435 \u0441\u0442\u0430\u043b. \u0410 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u043b, \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u044f\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0431\u044b \u0437\u0430\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0435 \u044f\u0434\u0440\u0430 \u0441\u0432\u0435\u0440\u0442\u043a\u0438 \u0431\u0435\u0437 \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u0438\u0445 \u0442\u0435\u043e\u0440\u0435\u043c, \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e, \u0434\u043b\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u044f\u0434\u0440\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438.\u0422\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0431\u0440\u043e\u0441\u043e\u043a \u0438\u0437 \u0442\u0435\u0442\u0440\u0430\u0434\u0438 \u0441 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u043e\u0439 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u0433\u043e\u0440\u043b\u044b\u0448\u043a\u0430\u0418\u0434\u0435\u044f \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0439: \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u0443\u0441\u043a\u0430?\u042f \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0437\u0430\u0434\u0430\u0447\u0438\u043b \u0441\u0432\u043e\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0418\u0418 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c: \u0430 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u0430 \u044d\u0442\u0438 \u0433\u043e\u0434\u044b \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435? \u0423\u0441\u043f\u043e\u043a\u0430\u0438\u0432\u0430\u044e\u0449\u0435\u0435 \u0448\u0443\u0440\u0448\u0430\u043d\u0438\u0435 \u0434\u0440\u043e\u0441\u0441\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 V100, \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e \u043e \u0442\u043e\u043c \u0447\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0448\u0435\u043b, \u0430 \u043f\u043e\u043c\u0430\u0440\u0433\u0438\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u043b\u043e \u0447\u0442\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043a\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430&#8230;  \u0412\u044b\u0441\u043a\u043e\u0447\u0438\u043b\u0430 \u043f\u0430\u0440\u0430 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 AlphaTensor \u043e\u0442 DeepMind \u0438 \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0440\u0430\u0431\u043e\u0442, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u0430\u0431\u043e \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u00ab\u0441\u0435\u0440\u0435\u0431\u0440\u044f\u043d\u043e\u0439 \u043f\u0443\u043b\u0435\u00bb. \u041d\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435 &#8212; \u043d\u0438 \u0443 \u043a\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u044f \u043d\u0435 \u0443\u0432\u0438\u0434\u0435\u043b \u0434\u0432\u0443\u0445 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0432\u0435\u0449\u0435\u0439: \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e\u0434 \u041b\u042e\u0411\u042b\u0415 \u0441\u0432\u0435\u0440\u0442\u043a\u0438 (\u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c Stride, Dilation \u0438 \u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0435\u0439), \u043d\u043e \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u043b \u0442\u043e\u0442 \u043a\u0440\u0443\u0442\u043e\u0439 \u043c\u0443\u0436\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0432\u0430\u043b\u0438 \u0428\u043c\u0443\u044d\u043b\u044c \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434.\u0413\u0435\u0448\u0442\u0430\u043b\u044c\u0442, \u0432\u0438\u0441\u0435\u0432\u0448\u0438\u0439 \u0432 \u0432\u043e\u0437\u0434\u0443\u0445\u0435 \u0433\u043e\u0434\u0430\u043c\u0438, \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b \u0441\u0440\u043e\u0447\u043d\u043e\u0439 \u0440\u0430\u0437\u0432\u044f\u0437\u043a\u0438&#8230;.\u0421\u043a\u0430\u0436\u0443 \u0447\u0435\u0441\u0442\u043d\u043e: \u044f \u043f\u0438\u0448\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043d\u0430 C++, CUDA \u0438 HDL (VHDL\/SystemVerilog). \u0412\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0431\u0435\u0437 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0443\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e. \u041d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0441\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u0443\u0440\u043e\u0432\u043d\u044f Python, \u0434\u0443\u043c\u0430\u044e, \u0431\u044b\u043b\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u043e &#8212; \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044f \u0431\u044b\u043b \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438.\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0418\u0418 \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u0442\u044c \u043c\u043d\u0435 \u043a\u0430\u0440\u043a\u0430\u0441 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u0440\u044f\u043c\u043e \u043f\u043e \u043c\u043e\u0435\u043c\u0443 \u0440\u0438\u0441\u0443\u043d\u043a\u0443 \u0438\u0437 \u0442\u0435\u0442\u0440\u0430\u0434\u0438 . \u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u043b\u0435\u0433\u043a\u043e &#8212; \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430-\u0442\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f.\u0414\u0432\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u044f (fc_D \u0438 fc_F) \u043a\u043e\u0434\u0438\u0440\u0443\u044e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 D \u0438 \u044f\u0434\u0440\u043e F \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u00ab\u0433\u043e\u0440\u043b\u044b\u0448\u043a\u043e\u00bb (inter_dim). \u0412 \u0433\u043e\u0440\u043b\u044b\u0448\u043a\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u200b. \u0422\u0440\u0435\u0442\u0438\u0439 \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (fc_C) \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0444\u043e\u0440\u043c\u0443 \u0432\u044b\u0445\u043e\u0434\u0430.class WinogradFromSketch(nn.Module):    def __init__(self, in_shape, out_shape, kernel_shape, inter_dim):        super().__init__()        self.fc_D = nn.Linear(math.prod(in_shape), inter_dim, bias=False)        self.fc_F = nn.Linear(math.prod(kernel_shape), inter_dim, bias=False)        self.fc_C = nn.Linear(inter_dim, math.prod(out_shape), bias=False)    def forward(self, D, F_tensor):        out_D = self.fc_D(D.view(B, -1))        out_F = self.fc_F(F_tensor.view(B, -1))        return self.fc_C(out_D * out_F).view(B, 1, *out_shape)\u0414\u0430\u043b\u044c\u0448\u0435 \u044f \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0446\u0438\u043a\u043b \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0433\u0434\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u00ab\u0438\u0441\u0442\u0438\u043d\u044b\u00bb \u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0443\u0436\u0438\u043b\u0430 \u0441\u0430\u043c\u0430 \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u0430\u044f \u0441\u0432\u0435\u0440\u0442\u043a\u0430 (F.conv1d, F.conv2d \u0438\u043b\u0438 F.conv3d), \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0436\u0430\u0442\u044c. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0430\u0442\u0447\u0438 D \u0438 F, \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0442 \u043d\u0438\u0445 \u0438\u0441\u0442\u0438\u043d\u043d\u0443\u044e \u0441\u0432\u0435\u0440\u0442\u043a\u0443 &#8212; \u0432\u043e\u0442 \u0432\u0430\u043c \u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0448\u0443\u043c\u043e\u043c.\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0442\u044c \u043e\u0431\u043d\u0443\u043b\u044f\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0438 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u0445 (\u0432\u0435\u0434\u044c \u043c\u044b \u0438\u0449\u0435\u043c \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u043a\u0430\u043a \u0443 \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430), \u044f \u043f\u043e\u0432\u0435\u0441\u0438\u043b \u043d\u0430 \u0432\u0435\u0441\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 L1-\u0448\u0442\u0440\u0430\u0444 \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0443\u043d\u0438\u043d\u0433 \u043f\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0440\u043e\u0431\u0438:\u041d\u0430\u0442\u0440\u0430\u0432\u0438\u043b Adam, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0443\u044e 1D-\u0441\u0432\u0435\u0440\u0442\u043a\u0443, \u043d\u0430\u0436\u0430\u043b Run \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0441\u044f \u0436\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0430\u043b\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438&#8230;\u0418 \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0432\u044b\u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u044f\u0441\u043d\u0430\u044f, \u0447\u0438\u0441\u0442\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430! \u041c\u043e\u044f \u0440\u0435\u0430\u043a\u0446\u0438\u044f \u0431\u044b\u043b\u0430: \u00ab\u0414\u0430 \u043b\u0430\u0434\u043d\u043e?!\u00bb, \u043a\u0430\u043a \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0443 \u043c\u043e\u0435\u0433\u043e \u043d\u0430\u043f\u0430\u0440\u043d\u0438\u043a\u0430 \u043f\u043e \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043a\u0435, \u043a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043e\u0442\u043d\u0438 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435, \u0438 \u043e\u043d\u0438 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441\u0442\u0440\u043e\u0433\u043e \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430.&#8212; Matrix fc_D (data) (shape: (4, 4)) &#8212;Zero percentage (&lt; 0.08333333333333333): 37.5%[[  0.00   0.76   0.98   0.00] [  0.00   0.89  -0.70   0.00] [  0.66   0.33  -0.66   0.00] [  0.00   0.63   0.31  -0.62]]&#8212; Matrix fc_F (kernel) (shape: (4, 3)) &#8212;Zero percentage (&lt; 0.08333333333333333): 33.3%[[  0.48   0.62   0.80] [  0.84  -0.65   0.51] [  1.24   0.00   0.00] [  0.00   0.00  -1.18]]&#8212; Matrix fc_C (output) (shape: (2, 4)) &#8212;Zero percentage (&lt; 0.08333333333333333): 25.0%[[  0.80  -1.06   1.22   0.00] [  1.02   0.83   0.00   1.36]]\u0418\u0442\u0430\u043a, \u0432\u0435\u0447\u0435\u0440 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0430\u043b \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u0435\u043c\u043d\u044b\u043c. \u0410 \u043a\u0442\u043e-\u0442\u043e \u0442\u0430\u043c \u0432 \u0442\u0435\u043c\u043d\u043e\u0442\u0435, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0442\u0438\u0445\u043e \u0441\u043d\u044f\u043b \u043b\u044b\u0436\u0438, \u043e\u0442\u043b\u043e\u0436\u0438\u043b \u043a\u043e\u0441\u0443 \u0438 \u043f\u043e\u0434\u0441\u0435\u043b \u043f\u043e\u0431\u043b\u0438\u0436\u0435&#8230;\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438 \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0441\u0445\u043e\u0434\u0438\u043b\u0441\u044f, \u043d\u043e \u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u0442\u043e\u0440\u043e\u043f\u043b\u0438\u0432\u043e. \u041c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u044f\u0432\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043f\u043e\u0434\u0437\u0430\u0442\u044b\u043b\u044c\u043d\u0438\u043a\u0438. \u041e\u0442\u043a\u0443\u0434\u0430 \u0438\u0445 \u0432\u0437\u044f\u0442\u044c? \u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0443 \u043d\u0430\u0441 \u0436\u0435 \u043f\u0440\u044f\u043c\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0443\u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443 &#8212; \u0442\u0435 \u0441\u0430\u043c\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0434\u0430\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443.\u0410\u0433\u0430! \u0411\u0443\u0434\u0435\u043c \u043a\u043e\u043f\u0438\u0442\u044c \u044d\u0442\u0438 \u00ab\u0442\u044f\u0436\u0435\u043b\u044b\u0435\u00bb \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 (HardExampleBuffer) \u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u0441\u0435\u0442\u044c \u043f\u043e \u043d\u0438\u043c. \u0418 \u044d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e: \u043f\u043e \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u044f\u043c, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u0441\u043a\u043e\u0447\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a!class HardExampleBuffer:    def __init__(self, capacity=1024 * 8):        self.capacity = capacity        self.D_buffer = None        self.F_buffer = None    def add_examples(self, D, F_tensor, errors, top_k=32):        # \u041e\u0442\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u044b\u0435 &#171;\u0442\u044f\u0436\u0435\u043b\u044b\u0435&#187; \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c MSE        _, top_idx = torch.topk(errors, k=min(top_k, D.size(0)))        # &#8230; \u0438 \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u044d\u0442\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u043a\u0430\u0436\u0434\u044b\u0435 \u043f\u0430\u0440\u0443 \u0448\u0430\u0433\u043e\u0432\u041d\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0435, \u0445\u043e\u0442\u044c \u0438 \u043e\u0447\u0435\u043d\u044c \u0442\u044f\u0436\u0435\u043b\u043e\u0439 \u043e\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b, \u0432\u044b\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0435\u0441\u0443\u0440\u0441 \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 &#8212; \u0437\u0430 \u0441\u0447\u0435\u0442 Python \u0438 \u0434\u043e\u0437\u0432\u043e\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0431\u0435 \u043f\u043e\u0433\u043e\u0432\u043d\u043e\u043a\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u0418\u0418 &#8212; \u0447\u0435\u0442\u043a\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0447\u0438\u0441\u0435\u043b, \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e ().\u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b ( \u0438 ) \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 &#8212; \u043e\u043d\u0438 \u0436\u0438\u0432\u0443\u0442 \u0432 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435  (\u0441\u043e\u0441\u0442\u043e\u044f \u0438\u0437 ). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0438\u0434\u0438\u0442 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435  \u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0441\u0432\u0435\u0440\u0442\u043a\u0438 \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0432\u043e\u0439. \u0427\u0442\u043e \u0441 \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c? \u0414\u0430 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e &#8212; \u0432\u043d\u043e\u0441\u0438\u043c \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0438! \u0418 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0443\u0441\u043a \u043e\u0442\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442.\u041d\u043e \u0435\u0441\u0442\u044c \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0439 \u043d\u044e\u0430\u043d\u0441: \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 scale \u0434\u043b\u044f \u0432\u0435\u0441\u043e\u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043f\u0440\u044f\u043c\u043e \u0441\u0440\u0430\u0437\u0443 &#8212; \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u043b\u044c\u0437\u044f&#8230;\u0415\u0441\u043b\u0438 \u0437\u0430\u0434\u0440\u0430\u0442\u044c scale \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0436\u0435 \u0448\u0430\u0433\u0430, \u043b\u0435\u043d\u0438\u0432\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0442\u0443\u0442 \u0436\u0435 \u043d\u0430\u0439\u0434\u0435\u0442 \u00ab\u0433\u0440\u044f\u0437\u043d\u043e\u0435\u00bb \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0431\u0435\u0441\u0442\u043e\u043b\u043a\u043e\u0432\u044b\u0439 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 (\u043d\u0443\u043b\u0435\u0439 \u043c\u044b \u0442\u0430\u043c \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u043c).\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0433\u043e\u043b\u043e\u0434\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u043d\u044c\u043e\u043d \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0434\u0435\u0440\u0436\u0438\u043c \u0432\u0435\u0441\u0430 \u043d\u0430 \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0434\u0438\u0435\u0442\u0435 () \u0438 \u043f\u043b\u0430\u0432\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u043c scale \u043e\u0442  \u0434\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f!# S-\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0439 \u0441\u0433\u043b\u0430\u0436\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u0433\u043e\u043d scale \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044fnew_scale = get_current_scale(step, steps, float(winograd_scale))if new_scale != model.scale:    with torch.no_grad():        # \u0418\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442 \u0432\u0435\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b MSE \u043d\u0435 \u0441\u043a\u0430\u043a\u0430\u043b \u043f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 scale        model.fc_C.weight.mul_(model.scale \/ new_scale)    model.scale = new_scale\u0420\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0438 \u0441\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u0435\u0441\u043e\u0432\u044b\u0445 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0432\u0441\u0451, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043e\u0447\u0435\u043d\u044c \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u0438 \u0434\u0430\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u0443 \u0434\u043b\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041d\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0437\u043d\u0430\u043d\u0438\u044f \u2014 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0441 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0434\u0443\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b\u0445 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u044f\u0434\u0440\u0430\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439!\u0418 \u0442\u0443\u0442 \u044f \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043e\u0434\u0438\u043d \u0444\u043e\u043a\u0443\u0441. \u0414\u0430\u0432\u043d\u043e \u044f \u043a\u0430\u043a-\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 (\u041c\u041d\u041a \/ Least Squares) \u0434\u043b\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u043f\u0440\u0438 \u0438\u0445 \u0444\u0440\u0430\u043a\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0436\u0430\u0442\u0438\u0438 \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u043b: \u0430 \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0432\u0437\u044f\u0442\u044c \u044d\u0442\u0438 \u043d\u0435\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438 \u043d\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0441 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0441\u0432\u0435\u0440\u0442\u043a\u0438?# &#8212; \u042f\u0434\u0440\u043e \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u043b\u044c\u0432\u0435\u0440\u0430 (SymPy + \u041c\u041d\u041a) &#8212;def prove_winograd_exact(model, target_sym, monomials, max_denom=36):    WD_float, WF_float = model.fc_D.weight.numpy(), model.fc_F.weight.numpy()    # 1. \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0438 q \u0438 \u043a\u0432\u0430\u043d\u0442\u0443\u0435\u043c WD \u0438 WF \u043a \u0434\u0440\u043e\u0431\u044f\u043c Q    for q in range(1, max_denom + 1):        WD_exact = snap_to_sympy_rationals(WD_float, limit_denom=q)        WF_exact = snap_to_sympy_rationals(WF_float, limit_denom=q)        # 2. \u0410\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u0443\u044e WC \u0447\u0435\u0440\u0435\u0437 \u041c\u041d\u041a (Least Squares)        M_num = build_monomial_matrix(WD_exact, WF_exact, monomials)        WC_num, *_ = np.linalg.lstsq(M_num, Target_num.T, rcond=None)        WC_exact = snap_to_sympy_rationals(WC_num.T, limit_denom=max_denom)        # 3. \u0421\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432 \u043a\u043e\u043b\u044c\u0446\u0435 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u043e\u0432 SymPy        M_sym = sp.Matrix(build_symbolic_monomials(WD_exact, WF_exact))        residual = sp.expand(sp.Matrix(WC_exact) * M_sym.T &#8212; target_sym)        # 4. \u0415\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043c\u0430\u0442\u0440\u0438\u0446 \u0441\u0442\u0440\u043e\u0433\u043e \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u0439\u0434\u0435\u043d!        if residual == sp.zeros(*residual.shape):            print(f&#187;[\u0423\u0421\u041f\u0415\u0425] \u0422\u043e\u0447\u043d\u043e\u0435 \u0442\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043f\u0440\u0438 q = {q} (\u043e\u0448\u0438\u0431\u043a\u0430 = 0)!&#187;)            return WD_exact, WF_exact, WC_exact, True    return None, None, None, False\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u043e\u043b\u0434\u0443\u043d\u0441\u0442\u0432\u0430 \u043d\u0430\u0434 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0443\u043c\u043a\u043e\u0439 &#8212; \u0443\u0436\u0435 \u043d\u0430 \u0437\u0430\u0440\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u043e\u043f\u044f\u0442\u044c: \u00ab\u0414\u0430 \u043d\u0443 \u043d\u0430\u0444\u0438\u0433!\u00bb. 100% \u043a\u043e\u043f\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430!&#8212; Symbolic Matrix fc_D (data) (shape: 4&#215;4) &#8212;[       0        1        1        0 ][       0        1       -1        0 ][       1        0       -1        0 ][       0        1        0       -1 ]Zero percentage: 50.0%&#8212; Symbolic Matrix fc_F (kernel) (shape: 4&#215;3) &#8212;[       1        1        1 ][       1       -1        1 ][       1        0        0 ][       0        0       -1 ]Zero percentage: 33.3%&#8212; Symbolic Matrix fc_C (output) (shape: 2&#215;4) &#8212;[     1\/2     -1\/2        1        0 ][     1\/2      1\/2        0        1 ]\u042f \u0437\u0430\u0432\u0430\u0440\u0438\u0432\u0430\u044e \u0431\u0435\u0441\u0441\u0447\u0435\u0442\u043d\u0443\u044e \u0447\u0430\u0448\u043a\u0443 \u0447\u0430\u044f \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u044f\u0434\u0440\u0430 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b \u0438 \u043d\u0435 \u0441\u043b\u044b\u0448\u0430\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u0444\u043e\u0440\u043c\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0412\u0438\u043d\u043e\u0433\u0440\u0430\u0434\u0430 \u0438 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442! \u041c\u0435\u0442\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!================================================================= Experiment Parameters (Winograd Algorithm Mining)=================================================================  Device                    : cuda  Data Type (dtype)         : torch.float32  Input Shape (in_shape)    : (5, 5) (25 elems)  Kernel Shape (kernel)     : (3, 3) (9 elems)  Output Shape&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-498360","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/498360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=498360"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/498360\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=498360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=498360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=498360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}