{"id":313063,"date":"2020-11-12T21:00:44","date_gmt":"2020-11-12T21:00:44","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=313063"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=313063","title":{"rendered":"\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 Tensorflow 1.x"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>Tensorflow, \u0445\u043e\u0442\u044f \u0438 \u0441\u0434\u0430\u0451\u0442 \u0441\u0432\u043e\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, <a href=\"https:\/\/thegradient.pub\/state-of-ml-frameworks-2019-pytorch-dominates-research-tensorflow-dominates-industry\/\">\u0432\u0441\u0451 \u0435\u0449\u0451 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c<\/a> \u0432 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0438\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d TF, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043d\u0430 \u043f\u043b\u0430\u0432\u0443 \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438: <a href=\"https:\/\/www.tensorflow.org\/lite\">Tensorflow Lite<\/a> \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0438 <a href=\"https:\/\/www.tensorflow.org\/tfx\/guide\/serving\">Tensorflow Serving<\/a> \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438. \u0412 \u0421\u0435\u0442\u0438 (\u0438 \u0434\u0430\u0436\u0435 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435) \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u043f\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u043d\u0430\u0448 \u043e\u043f\u044b\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443, \u043e\u043f\u0438\u0448\u0435\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 RAM, \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u0438 \u0441\u043b\u0430\u0431\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"v-kakih-usloviyah-my-rabotaem\">\u0412 \u043a\u0430\u043a\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c<\/h2>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 NLP \u2014 \u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432. \u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u0438\u043f\u0430 SVC \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f transformer-\u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 BERT \u0438 \u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c CNN \u2014 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412\u0430\u0436\u043d\u044b\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u043d\u0430\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 (\u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430) \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u0431\u0435\u0437 GPU. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u044d\u0442\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430. <\/p>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0431\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430\u043c\u0438 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0442\u0443\u043a. \u041a\u043e\u043c\u043f\u043b\u0435\u043a\u0442 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445, \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u043d\u0433\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <a href=\"https:\/\/www.tensorflow.org\/tfx\/guide\/serving\">Tensorflow Serving<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 TF \u0432\u0435\u0440\u0441\u0438\u0438 1.x, \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439. \u0414\u043b\u044f TF 2.x \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0442\u0435\u0445\u043d\u0438\u043a \u043b\u0438\u0431\u043e \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b, \u043b\u0438\u0431\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 API, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"kak-ustroena-tf-model\">\u041a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 TF-\u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e <a href=\"http:\/\/www.wildml.com\/2015\/12\/implementing-a-cnn-for-text-classification-in-tensorflow\/\">Shallow CNN<\/a> \u2014 \u0441\u0435\u0442\u044c \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u0432\u0435\u0440\u0442\u043e\u0447\u043d\u044b\u043c \u0441\u043b\u043e\u0435\u043c \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438. \u042d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u0435\u0431\u044f \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b\u0430 \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0441\u043b\u043e\u0432. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zk\/jm\/bd\/zkjmbdcbwlk6uktvsywbspndhwy.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0431\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e <em>v<\/em> x <em>k<\/em>, \u0433\u0434\u0435 <em>v<\/em> \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, <em>k <\/em>\u2014 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442:<\/p>\n<p>  <\/p>\n<ul>\n<li>Embedding-\u0441\u043b\u043e\u0439, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u0441\u043b\u043e\u0432\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0438\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/li>\n<li>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0451\u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0445 \u0441\u0432\u0451\u0440\u0442\u043e\u043a <em>w<\/em> x <em>k<\/em>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0431\u043e\u0440 \u043e\u043a\u043e\u043d (1, 1, 2, 3) \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c 4 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u0432\u0435\u0440\u0442\u043a\u0430\u043c, \u0434\u0432\u0435 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 1 \u0441\u043b\u043e\u0432\u043e, \u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e 2 \u0438 \u043f\u043e 3 \u0441\u043b\u043e\u0432\u0430, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/li>\n<li>Max-pooling \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0432\u0435\u0440\u0442\u043a\u0435. <\/li>\n<li>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0443\u043b\u0438\u043d\u0433\u0430 \u0435\u0434\u0438\u043d\u044b\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 dropout-\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0438 softmax-\u0441\u043b\u043e\u0439 \u0434\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 Adam, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u0441\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043e\u0432 \u0432\u0435\u0441\u043e\u0432. <\/p>\n<p>  <\/p>\n<p>\u041b\u0435\u0433\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438: \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0442\u0435\u043d\u0437\u043e\u0440\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u044f \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0432 \u0431\u0430\u0439\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0432\u0451\u0440\u0442\u043a\u0430, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u0440\u043e\u0434\u0443\u0446\u0438\u0440\u0443\u044e\u0449\u0430\u044f 128 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 c <em>w<\/em> = 2 \u0438 <em>k<\/em> = 300 \u043f\u0440\u0438 \u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0442\u0435\u043d\u0437\u043e\u0440\u0430 \u044f\u0434\u0440\u0430 (\u0444\u0438\u043b\u044c\u0442\u0440\u0430) <code>[filter_height, filter_width, in_channels, output_channels]<\/code> \u2014 \u044d\u0442\u043e \u0442\u0435\u043d\u0437\u043e\u0440, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 <code>2*300*1*128 = 76800<\/code> \u0447\u0438\u0441\u0435\u043b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0442\u0438\u043f\u0430 float32, \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c <code>76800*(32\/8) = 307200<\/code> \u0431\u0430\u0439\u0442.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043c\u044b \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u044d\u0442\u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u044b? \u041f\u0440\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u0435 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043a\u043e\u043b\u043e 220 \u0442\u044b\u0441. \u0441\u043b\u043e\u0432) \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043b\u043e\u044f \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u043e\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e 300 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 265 \u041c\u0411. \u042d\u0442\u043e \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438, \u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0440\u0430\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 TF \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0435\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0433\u0440\u0430\u0444\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0435\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 (\u0435\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0435\u0442), \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0433\u0440\u0430\u0444 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u2014 \u0433\u0440\u0430\u0444 \u0438 \u0432\u0435\u0441\u0430 (\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0438), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0413\u0440\u0430\u0444 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0443\u0437\u043b\u043e\u0432 (\u043d\u043e\u0434). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0433\u0440\u0430\u0444 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-5\/6e\/zm\/-56ezmu1f6z2fyowcv7sbd5bow8.png\" alt=\"\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\"\/><\/p>\n<p>  <\/p>\n<h2 id=\"kak-model-hranitsya-na-diske\">\u041a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043d\u0430 \u0434\u0438\u0441\u043a\u0435<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445: \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442 \u0438 \u0444\u043e\u0440\u043c\u0430\u0442 SavedModel. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0438\u0437\u043a\u0438\u0435 \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0444\u043e\u0440\u043c\u0430\u0442\u044b, \u043e\u0431\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u0433\u0440\u0430\u0444 \u0438 \u0432\u0435\u0441\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445. <\/p>\n<p>  <\/p>\n<h3 id=\"checkpoint\">Checkpoint<\/h3>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442, \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/compat\/v1\/train\/Saver\">Saver API<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">saver = tf.train.Saver(save_relative_paths=True) ckpt_filepath = saver.save(sess, &quot;cnn.ckpt&quot;), global_step=0)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>global_step<\/em> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0448\u0430\u0433, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u044b\u043b\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u0438 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0448\u0430\u0433 \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b <em>cnn-ckpt-0<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0430\u043f\u043a\u0438 <em>&lt;model_path&gt;\/cnn_ckpt <\/em> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xi\/bt\/to\/xibttojodurplcnvnwrn4ubgbb8.jpeg\"\/><\/p>\n<p>  <\/p>\n<p>\u0424\u0430\u0439\u043b <em>checkpoint<\/em> \u2014 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0443\u0442\u044c \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u0438. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0438 TF \u043f\u0440\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0439\u0434\u0451\u0442 \u043f\u0443\u0442\u044c \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0443. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e.<\/p>\n<p>  <\/p>\n<p>\u0424\u0430\u0439\u043b <em>.data<\/em> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0435 \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0433\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u2014 \u043e\u043a\u043e\u043b\u043e 800 \u041c\u0411. \u0412\u044b\u0448\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043b\u0438, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043b\u043e\u0439 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u043e\u0432 (\u2248265 \u041c\u0411). \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u044a\u0451\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u0430 (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043e\u0432). \u041e\u043d\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0424\u0430\u0439\u043b <em>.index<\/em> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043c\u0435\u043d\u0430 \u043d\u043e\u0434 \u0438 \u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u044b.<\/p>\n<p>  <\/p>\n<p>\u0424\u0430\u0439\u043b <em>.meta<\/em> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u043c \u043c\u0435\u0442\u0430\u0433\u0440\u0430\u0444\u043e\u043c \u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0433\u0440\u0430\u0444 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 (\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438), \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 \u0432\u0438\u0434\u0435 <em>GraphDef<\/em>, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0433\u0440\u0430\u0444\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435, \u0438 \u044d\u0442\u043e \u0432\u0440\u044f\u0434 \u043b\u0438 \u0431\u044b \u0437\u0430\u043d\u044f\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0430\u0440\u044b \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442. \u041d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u043e\u0433\u0434\u0430 \u0444\u0430\u0439\u043b <em>.meta<\/em> \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u043c\u0435\u0441\u0442\u0430, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0439 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u043e\u0432? \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e TF \u0437\u0430\u0447\u0435\u043c-\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 embedding-\u0441\u043b\u043e\u044f. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u043d\u043e \u043d\u0430\u043c \u044d\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u044d\u0442\u0443 \u043d\u043e\u0434\u0443 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u0433\u0440\u0430\u0444\u0430. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0438\u043d\u0441\u043f\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0434\u044b \u0433\u0440\u0430\u0444\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">with tf.Session() as sess:    saver = tf.train.import_meta_graph('models\/ckpt_model\/cnn_ckpt\/cnn.ckpt-0.meta')  # load meta    for n in tf.get_default_graph().as_graph_def().node:        print(n.name, n['attr'].shape)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/www.tensorflow.org\/guide\/checkpoint\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<h3 id=\"savedmodel\">SavedModel<\/h3>\n<p>  <\/p>\n<p>\u0424\u043e\u0440\u043c\u0430\u0442, \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u0435\u0440\u0432\u0438\u043d\u0433\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 API tf.saved_model. \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0439 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0447\u0435\u0440\u0435\u0437 tf.saved_model, \u0442\u0430\u043a \u0438 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b TF-\u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b (<a href=\"https:\/\/tensorflow.org\/lite\">TFLite<\/a>, <a href=\"https:\/\/js.tensorflow.org\/\">TensorFlow.js<\/a>, <a href=\"https:\/\/www.tensorflow.org\/tfx\/serving\/tutorials\/Serving_REST_simple\">TensorFlow Serving<\/a>, <a href=\"https:\/\/tensorflow.org\/hub\">TensorFlow Hub<\/a>).<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/36\/2e\/br\/362ebrsbmstzydlwqdpg_3gkfdy.jpeg\"\/><\/p>\n<p>  <\/p>\n<p>\u0424\u0430\u0439\u043b <em>saved_model.pb<\/em>, \u043f\u043e \u0441\u0443\u0442\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u043e\u0442 \u0436\u0435 \u043c\u0435\u0442\u0430\u0433\u0440\u0430\u0444, \u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 <em>.meta<\/em> \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0435\u0442\u0430\u0433\u0440\u0430\u0444\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0434\u043b\u044f \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 API, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u0445 (\u0438 \u0434\u0430\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 CLI, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0432\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430).<\/p>\n<p>  <\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0444\u0438\u0447\u0435\u0439 SavedModel \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0441\u0441\u0435\u0442\u043e\u0432 \u2014 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0438. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u201c\u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u044c\u201d \u043a \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u0435\u0442\u043e\u043a, \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432 \u2014 \u0432 \u043e\u0431\u0449\u0435\u043c, \u0432\u0441\u0451 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<p>  <\/p>\n<h2 id=\"osnovnye-metody-optimizacii-modeli\">\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0438\u043c\u0435\u0435\u043c CNN-\u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 TF \u0432\u0435\u0440\u0441\u0438\u0438 1.x, \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0438 \u0438\u043d\u0444\u0435\u0440\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u043e\u043c \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0432\u0441\u0442\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0451\u043c\u0430 \u043c\u043e\u0434\u0435\u043b\u0438. <\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u0448\u0435\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043e\u043a\u043e\u043b\u043e 1 \u0413\u0411, \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li><strong>\u0417\u0430\u043c\u043e\u0440\u043e\u0437\u043a\u0430 \u0433\u0440\u0430\u0444\u0430<\/strong><br \/>  \u0412\u0435\u0441\u0430 \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b. \u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0433\u0440\u0430\u0444\u0430, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445\u0441\u044f \u0432 \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 ( tools.optimize_for_inference ).<\/li>\n<li><strong>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043b\u0451\u0433\u043a\u043e\u0433\u043e \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430<\/strong><br \/>  \u0412\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0433\u0440\u0430\u0444\u0430. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043c\u044b \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0435\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0441\u0442\u0430\u0434\u0438\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u2014 \u0443\u0437\u043b\u044b \u0433\u0440\u0430\u0444\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u043d\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432 tf.trainable_variables(). <\/li>\n<li><strong>\u041f\u0440\u0443\u043d\u0438\u043d\u0433<\/strong><br \/>  \u041e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0441\u043e\u0432, \u0441\u043b\u0430\u0431\u043e \u0432\u043b\u0438\u044f\u044e\u0449\u0438\u0445 \u043d\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435. \u041e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (\u043d\u0430\u043f\u0440. BERT).<\/li>\n<li><strong>\u041a\u0432\u0430\u043d\u0442\u0438\u0437\u0430\u0446\u0438\u044f<\/strong><br \/>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c \u0441 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e. \u041c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0432\u043e \u0432\u0440\u0435\u043c\u044f, \u0442\u0430\u043a \u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0427\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u043f\u0440\u0443\u043d\u0438\u043d\u0433\u043e\u043c.<\/li>\n<li><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438<\/strong><\/li>\n<\/ol>\n<p>  <\/p>\n<h3 id=\"zamorozka-grafa\">\u0417\u0430\u043c\u043e\u0440\u043e\u0437\u043a\u0430 \u0433\u0440\u0430\u0444\u0430<\/h3>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u0441\u0430\u043c \u0433\u0440\u0430\u0444, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0438\u0445 \u0432\u0435\u0441\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442. \u0417\u0430\u043c\u043e\u0440\u043e\u0437\u043a\u0430 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043d\u043e\u0434 \u0433\u0440\u0430\u0444\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f forward pass, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u0438. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435\u043b\u044c\u0437\u044f \u0434\u043e\u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 1 \u0413\u0411 \u0434\u043e 265 \u041c\u0411.<\/p>\n<p>  <\/p>\n<p>\u0412 TF 1.x \u044d\u0442\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438, \u0432\u0441\u0435 \u043e\u043d\u0438 \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u0430\u043c.<\/p>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0433\u0440\u0430\u0444\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 (\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441 \u0434\u0438\u0441\u043a\u0430 \u0438\u043b\u0438 \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438) \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 GraphDef:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">graph = tf.get_default_graph() input_graph_def = graph.as_graph_def()<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043c\u043e\u0440\u043e\u0437\u043a\u0430. \u041c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430: <a href=\"https:\/\/github.com\/tensorflow\/tensorflow\/blob\/master\/tensorflow\/python\/tools\/freeze_graph.py\">tf.python.tools.freeze_graph<\/a> \u0438 <a href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/compat\/v1\/graph_util\/convert_variables_to_constants\">tf.graph_util.convert_variables_to_constants<\/a>. \u041e\u0431\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0432 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0433\u0440\u0430\u0444 (\u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0443\u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442 \u0441 \u0434\u0438\u0441\u043a\u0430) \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u043e\u0434 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>['output\/predictions']<\/code>), \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435, \u043a\u0430\u043a\u0438\u0435 \u043d\u043e\u0434\u044b \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430, \u0430 \u043a\u0430\u043a\u0438\u0435 \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u043f\u043e\u0434\u0430\u0447\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0433\u0440\u0430\u0444\u0430 \u0438 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u043d\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">output_graph_def = graph_util.convert_variables_to_constants(self.sess, input_graph_def, output_node_names)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0433\u0440\u0430\u0444 \u043d\u0443\u0436\u043d\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.<br \/>  <code>freeze_graph()<\/code> \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0433\u0440\u0430\u0444 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d, \u043f\u043e\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <code>graph_util.convert_variables_to_constants()<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">with tf.io.gfile.GFile('graph.pb', 'wb') as f:     f.write(output_graph_def.SerializeToString())<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432\u0435\u0441\u0438\u0442 \u0432\u0441\u0435\u0433\u043e 266 \u041c\u0411, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u044d\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043d\u0430 \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c GraphDef \u0438\u0437 \u0444\u0430\u0439\u043b\u0430  with tf.io.gfile.GFile(graph_filepath, 'rb') as f:     graph_def = tf.GraphDef()     graph_def.ParseFromString(f.read())  with tf.Graph().as_default() as graph:     # \u0437\u0430\u0434\u0430\u0451\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u044b     self.input_x = tf.placeholder(tf.int32, [None, self.properties.max_len], name=&quot;input_x&quot;)     self.dropout_keep_prob = tf.placeholder(tf.float32, name=&quot;dropout_keep_prob&quot;)     # \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0438\u0437 \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e graph_def     input_map = {'input_x': self.input_x, 'dropout_keep_prob': self.dropout_keep_prob}     tf.import_graph_def(graph_def, input_map)<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041a \u043b\u044e\u0431\u043e\u0439 \u043d\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u044f\u043c\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0433\u0440\u0430\u0444\u0435, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043a \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043d\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0444\u0438\u043a\u0441 import:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">predictions = graph.get_tensor_by_name('import\/output\/predictions:0')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">feed_dict = {self.input_x: encode_sentence(sentence), self.dropout_keep_prob: 1.} sess.run(self.predictions, feed_dict)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0433\u0440\u0430\u0444\u0430\u043c\u0438 \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0438. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0433\u0440\u0430\u0444 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u0435\u0441\u0441\u0438\u0438, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>sess.run(...)<\/code>. \u041f\u0440\u0438 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0430 CPU \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0437\u0430 20 ms, \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u043e \u0434\u043e ~2700 ms. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0433\u0440\u0430\u0444\u0430 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435. \u041f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0438\u0437 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430 \u0438\u043b\u0438 \u0438\u0437 SavedModel \u0442\u0430\u043a\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043d\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u043b\u043e\u0441\u044c.<\/li>\n<li>\u041d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 RAM. \u041f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441 \u0438\u0437 \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 RAM, \u0447\u0435\u043c \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0438\u0437 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0435 \u0441\u0430\u043c\u044b\u0435 ~265 \u041c\u0411, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e TF \u043d\u0435 \u0443\u0442\u0438\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0438\u0437 GraphDef \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/li>\n<li>\u0415\u0449\u0451 \u043e\u0434\u043d\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u2013 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 RAM \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0435\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 TF \u0440\u0430\u0437\u043d\u043e\u0435. \u0412 1.15, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 TF 1.x, \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0435\u0441\u0441\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 118 MiB, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0432 1.14 \u2013 \u0432\u0441\u0435\u0433\u043e 3 MiB.<\/li>\n<\/ol>\n<p>  <\/p>\n<h3 id=\"lyogkiy-chekpoint\">\u041b\u0451\u0433\u043a\u0438\u0439 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442<\/h3>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0430 \u043d\u0430\u0434 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u043d\u0430\u0441 \u0431\u044b\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0443\u0437\u043b\u043e\u0432 \u0433\u0440\u0430\u0444\u0430, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0435. \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0433\u0438\u0431\u043a\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e? \u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <a href=\"https:\/\/github.com\/tensorflow\/docs\/blob\/master\/site\/en\/r1\/guide\/saved_model.md\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f\/\u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f TF-\u043c\u043e\u0434\u0435\u043b\u0438 tf.train.Saver. \u041e\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u0437\u0430\u043c\u043e\u0440\u043e\u0437\u043a\u0435 \u0433\u0440\u0430\u0444\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0443\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430 \u0432\u0441\u0451 \u043b\u0438\u0448\u043d\u0435\u0435: <\/p>\n<p>  <\/p>\n<ul>\n<li>\u0412\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0433\u0440\u0430\u0444\u0430<\/li>\n<li>\u0412\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f MetaGraph<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c tf.train.Saver \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c. \u0414\u043b\u044f \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u0438, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">saver = tf.train.Saver(var_list=tf.trainable_variables())<\/code><\/pre>\n<p>  <\/p>\n<p>MetaGraph \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0433\u0440\u0430\u0444\u0430 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0433\u0440\u0430\u0444 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0430 \u0438\u0437 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0435, \u0438 \u0442\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 meta \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442. \u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 MetaGraph \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u043b\u0430\u0433 \u0432 \u043c\u0435\u0442\u043e\u0434 <em>save<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">ckpt_filepath = saver.save(self.sess, filepath, write_meta_graph=False)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u043c\u044b \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430 1014 M\u0411 \u0434\u043e 265 M\u0411 (\u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u0433\u0440\u0430\u0444\u043e\u043c).<\/p>\n<p>  <\/p>\n<h3 id=\"pruning\">\u041f\u0440\u0443\u043d\u0438\u043d\u0433<\/h3>\n<p>  <\/p>\n<p>Pruning \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u0445 \u0432\u0435\u0441\u043e\u0432 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044f \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438. <a href=\"https:\/\/arxiv.org\/pdf\/1710.01878.pdf\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439<\/a> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u0447\u0442\u043e \u0446\u0435\u043d\u043e\u0439 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0442\u0435\u0440\u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0443\u043d\u0438\u043d\u0433 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0443\u043d\u0438\u043d\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432 TF 1.x: <\/p>\n<p>  <\/p>\n<ul>\n<li>Grappler: c\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0440\u0430\u0444\u043e\u0432 tensorflow \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<\/li>\n<li>Pruning API: \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f google-research<\/li>\n<li>Graph Transform Tool: \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0440\u0430\u0444\u0430 tensorflow, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 Grappler. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 Grappler \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <a href=\"https:\/\/www.tensorflow.org\/guide\/graph_optimization\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>. \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 set_experimental_options. \u041c\u044b \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0443\u043d\u0438\u043d\u0433\u043e\u043c, \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u044f \u0432 \u0445\u043e\u0434\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0436\u0430\u0442\u043e\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e zip \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430. \u041e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 zip \u0430\u0440\u0445\u0438\u0432\u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0443\u043d\u0438\u043d\u0433\u0430 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0430 \u0434\u0435\u043b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u043c \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432. \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 Grappler \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0443\u043d\u0438\u043d\u0433\u0430. <\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <a href=\"https:\/\/github.com\/google-research\/google-research\/tree\/master\/model_pruning\">\u043f\u0440\u0443\u043d\u0438\u043d\u0433\u0430 \u043e\u0442 google-research<\/a> \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 mask \u0438 threshold, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u043c \u0441\u043b\u043e\u044f\u043c \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u0435\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0432\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f. \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0443\u043d\u0438\u043d\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u0443\u044e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 mask \u0438 threshold, \u0434\u043b\u044f \u0437\u0430\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432, \u0434\u0430\u044e\u0449\u0438\u0445 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u0432\u043a\u043b\u0430\u0434 \u0432 \u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0443\u043d\u0438\u043d\u0433\u0430 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0430.<\/p>\n<p>  <\/p>\n<p>\u0411\u044b\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043c \u0441 Grappler, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0430\u043a\u0436\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c. \u0412\u043e\u0437\u043d\u0438\u043a \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0443\u043d\u0438\u043d\u0433 \u0438\u043b\u0438 \u043d\u0435\u0442? \u0415\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u0447\u0435\u043c\u0443 \u0440\u0430\u0437\u043c\u0435\u0440 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f? \u0414\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0434\u0432\u0430 \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0433\u0440\u0430\u0444\u0430 \u0441 \u043f\u0440\u0443\u043d\u0438\u043d\u0433\u043e\u043c \u0438 \u0431\u0435\u0437, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 0.99 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438. \u0414\u0430\u043b\u0435\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0443 mc, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0430 \u0432 hex \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b hex-\u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bq\/sx\/ts\/bqsxtsqg0ozrtn_z9sworc5njyq.jpeg\"\/><\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0441\u043b\u0435\u0432\u0430 \u0443 \u043d\u0430\u0441 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0441\u043f\u0440\u0430\u0432\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0439. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u043e\u0431\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u0430. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u0440\u0443\u043d\u0438\u043d\u0433 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0438, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u0443\u043d\u0438\u043d\u0433, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0430 \u0438 \u043d\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e \u0431\u044b \u0442\u043e \u043d\u0438 \u0431\u044b\u043b\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440. \u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u043b\u043e\u0451\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u043e\u0431\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0444\u0430\u0439\u043b\u0430, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0436\u0435 \u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u0438. <\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043d\u0430\u043c\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 CNN. \u0412\u043e\u043f\u0440\u043e\u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0443\u043d\u0438\u043d\u0433\u0430 \u043a \u044d\u043c\u0431\u0435\u0434\u0438\u043d\u0433\u0430\u043c \u043d\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043d\u0435 \u0431\u044b\u043b.<\/p>\n<p>  <\/p>\n<h3 id=\"kvantizaciya\">\u041a\u0432\u0430\u043d\u0442\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u043a\u0432\u0430\u043d\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <a href=\"https:\/\/github.com\/tensorflow\/tensorflow\/blob\/master\/tensorflow\/tools\/graph_transforms\/README.md\">Graph transform tool<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <em>quantize_weights<\/em> \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0436\u0438\u043c\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432\u0435\u0441\u043e\u0432\u044b\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e 8 \u0431\u0438\u0442. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0435\u043a\u043e\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 8-\u0431\u0438\u0442\u043d\u044b\u0435 \u0432\u0435\u0441\u043e\u0432\u044b\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0447\u0438\u0441\u043b\u0430 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u043e \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439. <\/p>\n<p>  <\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f <em>quantize_nodes<\/em> \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0432\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0441 \u0432\u0435\u0441\u0430\u043c\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 8-\u0431\u0438\u0442\u043d\u044b\u0435 \u0441 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434. <\/p>\n<p>  <\/p>\n<p>\u0412 \u0442\u0435\u043e\u0440\u0438\u0438, \u043e\u0431\u0430 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0443\u0445\u0443\u0434\u0448\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437-\u0437\u0430 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0441\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <em>quantize_weights<\/em> \u043c\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0443\u0445\u0443\u0434\u0448\u0435\u043d\u0438\u044f \u043f\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0443, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0432 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0441\u044f \u0432 4 \u0440\u0430\u0437\u0430. <\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u043c\u0438 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445, \u0441\u043e\u0432\u0435\u0442\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 TensorFlow Lite, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0430 \u0440\u0435\u0436\u0438\u043c\u0430.<\/p>\n<p>  <\/p>\n<h3 id=\"ispolzovanie-tipov-dannyh-menshey-tochnosti\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438<\/h3>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0445, \u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043c\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f 64 (32) \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u043e \u043f\u0440\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043a\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0439. <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043a \u043d\u043e\u0432\u044b\u043c \u0442\u0438\u043f\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0435 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430\u0445 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0438 RAM \u043d\u0430 Ubuntu (\u0433\u0434\u0435 numpy \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 int64) \u0437\u0430 \u0441\u0447\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0432 \u0438 \u043c\u0435\u0442\u043e\u043a \u043b\u0435\u0439\u0431\u043b\u043e\u0432. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b 220 \u0442\u044b\u0441\u044f\u0447 \u0441\u043b\u043e\u0432, \u0442\u043e \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f int32, \u0430 \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043b\u0435\u0439\u0431\u043b\u043e\u0432 int16. \u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u044d\u0442\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0430 \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/id\/lk\/iy\/idlkiyea7rznkxbv5eqpdhru_v0.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u043d\u0430\u0434 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u044b \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 tf-\u0433\u0440\u0430\u0444\u0430. \u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0435 \u043f\u043e\u043d\u0438\u0436\u0430\u043b\u0430\u0441\u044c \u0434\u043e float16. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043c\u0435\u043d\u044c\u0448\u0435 10%), \u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f (\u0434\u043e 10 \u0440\u0430\u0437). \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0445\u043e\u0442\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f epsilon \u0438 learning_rate \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441, \u0441 \u0447\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c.<\/p>\n<p>  <\/p>\n<h2 id=\"vliyanie-optimizacii-na-ram\">\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 RAM<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0445\u0438\u043d\u0430\u0446\u0438\u0439 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043e\u0431\u044a\u0451\u043c, \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0439 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u044b\u0439 \u0434\u043b\u044f \u043d\u0430\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ta\/us\/6y\/taus6yyboamnphs5essvebak0ky.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0435\u0433\u043a\u0438\u0439 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438, \u0442. \u043a. \u043e\u043d \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u0435\u043d\u0435\u0435 \u043e\u0441\u0442\u0440\u044b\u0435 \u043f\u0438\u043a\u0438 \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0438 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"qa-sekciya\">QA-\u0441\u0435\u043a\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<p><strong>Q:<\/strong> \u0423 \u0432\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0442\u044f\u0436\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433-\u0441\u043b\u043e\u0439, \u0432\u044b \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u0441 \u043d\u0438\u043c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<p>  <\/p>\n<p><strong>A:<\/strong> \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0432\u0435\u0441 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043b\u043e\u0439 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u044f. \u0414\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u043e\u0432 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c word2vec. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0438\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (\u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043f\u043e\u0445, min count, learning rate), \u043c\u044b \u043f\u0440\u0438\u0448\u043b\u0438 \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0432 220 \u0442\u044b\u0441\u044f\u0447 \u0441\u043b\u043e\u0432 (\u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043b\u043e\u044f \u044d\u043c\u0431\u0435\u0434\u0434\u0434\u0438\u043d\u0433\u043e\u0432 \u2014 265 MB) \u0431\u0435\u0437 \u0443\u0445\u0443\u0434\u0448\u0435\u043d\u0438\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0448\u0435\u0439 CNN, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0432 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b 439 \u0442\u044b\u0441\u044f\u0447 \u0441\u043b\u043e\u0432 (510 MB).<\/p>\n<p>  <\/p>\n<p>\u0423\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433-\u0441\u043b\u043e\u044f \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c, \u0438 \u0432\u0441\u0451 \u0436\u0435 \u043e\u043d \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0442\u044f\u0436\u0435\u043b\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0441\u0432\u043e\u0451 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u0441\u0430\u0431\u0432\u043e\u0440\u0434\u044b (\u0438\u043b\u0438 \u043a\u0443\u0441\u043e\u0447\u043a\u0438 \u0441\u043b\u043e\u0432). \u0412 \u0442\u0430\u043a\u0438\u0445 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u0430\u0445 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u043d\u0435 \u0438\u0437 \u0441\u043b\u043e\u0432, \u0430 \u0438\u0437 \u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u043e\u043a\u0435\u043d\u0430\u0439\u0437\u0435\u0440 YouTokenToMe, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u043f\u043e\u0442\u043e\u043c \u043f\u0430\u0440\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0442.\u0435. \u0431\u0438\u0433\u0440\u0430\u043c\u043c\u044b, \u0437\u0430\u0442\u0435\u043c \u0442\u0440\u0438\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0442.\u0434., \u043f\u043e\u043a\u0430 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432 \u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0446\u0435\u043b\u044b\u0435 \u0441\u043b\u043e\u0432\u0430. \u0422\u0430\u043a\u0438\u0435 \u043a\u0443\u0441\u043e\u0447\u043a\u0438 \u0441\u043b\u043e\u0432 \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c\u044b \u043c\u044b \u0441\u0430\u043c\u0438 \u043c\u043e\u0436\u0435\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0441\u0435 \u0446\u0435\u043b\u044b\u0435 \u0441\u043b\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0438\u0437 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u043a\u0443\u0441\u043e\u0447\u043a\u043e\u0432 \u0441\u043b\u043e\u0432. \u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043c\u044b \u043f\u0440\u0438\u0448\u043b\u0438 \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0432 30 \u0442\u044b\u0441\u044f\u0447 \u0441\u0430\u0431\u0432\u043e\u0440\u0434\u043e\u0432 (37 MB) \u0431\u0435\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0442\u0435\u0440\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430, \u0430 \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u043e\u0441\u044c \u0432 3.7 \u0440\u0430\u0437\u0430 \u043d\u0430 CPU \u0438 \u0432 2.6 \u0440\u0430\u0437\u0430 \u043d\u0430 GPU. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043b\u043e\u0432\u0430\u0440\u044f (\u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u044b), \u043d\u043e \u0438 \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 OOV-\u0441\u043b\u043e\u0432.<\/p>\n<p>  <\/p>\n<p><strong>Q:<\/strong> \u041e\u043a\u0435\u0439, \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u0436\u0430\u043b\u0438, \u043d\u043e \u043e\u043d\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441\u0430?<\/p>\n<p>  <\/p>\n<p><strong>A:<\/strong> \u041d\u0435\u0442, \u043c\u044b \u0443\u043c\u0435\u0435\u043c \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0442\u044c \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0438 \u043b\u0435\u0433\u043a\u0438\u0439 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442. <\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u043c\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0430:<\/p>\n<p>  <\/p>\n<p><strong>\u0428\u0430\u0433 1.<\/strong> \u0412\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0433\u0440\u0430\u0444 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">with tf.gfile.GFile(path_to_pb, 'rb') as f:     graph_def = tf.GraphDef()     graph_def.ParseFromString(f.read()) with tf.Graph().as_default() as graph:     tf.import_graph_def(graph_def, name='')     return graph<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0428\u0430\u0433 2.<\/strong> &quot;\u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0435\u043c&quot; \u0432\u0435\u0441\u0430 \u0438\u0437 \u0433\u0440\u0430\u0444\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">sess.run(restored_variable_names)<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0428\u0430\u0433 3.<\/strong> \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0441\u0451, \u043a\u0440\u043e\u043c\u0435 \u0432\u044b\u0442\u0430\u0449\u0435\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u0435\u0441\u043e\u0432.<br \/>  <strong>\u0428\u0430\u0433 4.<\/strong> \u041f\u0435\u0440\u0435\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0433\u0440\u0430\u0444, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0432\u0435\u0441\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">tf.Variable(tensors_to_restore[&quot;output\/W:0&quot;], name=&quot;W&quot;)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043b\u0435\u0433\u043a\u043e\u0433\u043e \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0433\u0440\u0430\u0444, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u0434 \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u0437 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. <\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u043e\u0442\u0435\u0440\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0432\u0435\u0441\u0430\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432, \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043d\u0435\u0441\u0436\u0430\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u0436\u0430\u0442\u044b\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u044b \u0434\u043e\u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438, \u043d\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441 \u044d\u0442\u0438\u043c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<p>  <\/p>\n<p><strong>Q:<\/strong> \u0415\u0441\u0442\u044c \u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0435\u0449\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438? <\/p>\n<p>  <\/p>\n<p><strong>A:<\/strong> \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0434\u0435\u0439, \u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0442\u0430\u043a \u0438 \u043d\u0435 \u0434\u043e\u0448\u043b\u0438. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, constant folding \u2014 \u044d\u0442\u043e \u201c\u0441\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435\u201d \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0443\u0437\u043b\u043e\u0432 \u0433\u0440\u0430\u0444\u0430, \u043f\u0440\u0435\u0434\u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0435\u0439 \u0433\u0440\u0430\u0444\u0430, \u0441\u043b\u0430\u0431\u043e \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0445 \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0432 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0443\u043d\u0438\u043d\u0433 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u043e\u0432.<\/p>\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\/post\/527786\/\"> https:\/\/habr.com\/ru\/post\/527786\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>Tensorflow, \u0445\u043e\u0442\u044f \u0438 \u0441\u0434\u0430\u0451\u0442 \u0441\u0432\u043e\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, <a href=\"https:\/\/thegradient.pub\/state-of-ml-frameworks-2019-pytorch-dominates-research-tensorflow-dominates-industry\/\">\u0432\u0441\u0451 \u0435\u0449\u0451 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c<\/a> \u0432 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0438\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d TF, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043d\u0430 \u043f\u043b\u0430\u0432\u0443 \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438: <a href=\"https:\/\/www.tensorflow.org\/lite\">Tensorflow Lite<\/a> \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0438 <a href=\"https:\/\/www.tensorflow.org\/tfx\/guide\/serving\">Tensorflow Serving<\/a> \u0434\u043b\u044f \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438. \u0412 \u0421\u0435\u0442\u0438 (\u0438 \u0434\u0430\u0436\u0435 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435) \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u043f\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u043d\u0430\u0448 \u043e\u043f\u044b\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443, \u043e\u043f\u0438\u0448\u0435\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 RAM, \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u0438 \u0441\u043b\u0430\u0431\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-313063","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313063","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=313063"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313063\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}