{"id":5220,"date":"2022-04-19T01:04:55","date_gmt":"2022-04-18T17:04:55","guid":{"rendered":"https:\/\/blog.iyatt.com\/?p=5220"},"modified":"2024-05-05T14:19:06","modified_gmt":"2024-05-05T06:19:06","slug":"tensorflow-%e9%99%90%e5%88%b6%e6%98%be%e5%ad%98%e4%bd%bf%e7%94%a8%e9%87%8f","status":"publish","type":"post","link":"https:\/\/blog.iyatt.com\/?p=5220","title":{"rendered":"TensorFlow \u9650\u5236\u663e\u5b58\u4f7f\u7528\u91cf"},"content":{"rendered":"\n<p>\u5bf9\u4e8e\u9ad8\u914d\u7684\u8ba1\u7b97\u673a\uff0c\u53ef\u80fd\u90fd\u4e0d\u7528\u8003\u8651\u9650\u5236\u663e\u5b58\u8fd9\u4e2a\u95ee\u9898\uff0c\u4f46\u662f\u6211\u8981\u8003\u8651\u3002\u6211\u8f7b\u8584\u672c\u5c31 2GB \u72ec\u663e\uff0c\u9ed8\u8ba4\u52a0\u8f7d\u6570\u636e\u65f6\u4f1a\u4e00\u6b21\u6027\u5168\u90e8\u5f80\u663e\u5b58\u91cc\u5199\uff0c\u7ed3\u679c\u52a8\u4e0d\u52a8\u5c31\u63d0\u793a\u663e\u5b58\u4e0d\u591f\uff0c\u7136\u540e\u7a0b\u5e8f game over\u3002<\/p>\n\n\n\n<p>\u53e6\u5916\u5c31\u662f\u5bf9\u4e8e\u5f00\u53d1\u677f\uff0c\u6211\u8fd9\u91cc\u4e5f\u5728\u7528 Jetson Nano \u7684\u5f00\u53d1\u677f\uff0cGPU \u6ca1\u6709\u72ec\u7acb\u663e\u5b58\uff0c\u662f\u548c CPU \u5171\u7528 4GB \u7684\u5185\u5b58\uff0c\u53ea\u8981\u4e00\u8dd1 tf \u7a0b\u5e8f\uff0c\u5185\u5b58\u8e6d\u8e6d\u5f80\u4e0a\u98d9\uff0c\u7740\u4e0d\u4f4f\u554a\u3002\u5e26\u6765\u7684\u5c31\u662f CPU \u53ef\u7528\u7684\u5185\u5b58\u51cf\u5c11\uff0c\u90a3\u4e48\u5c31\u5361\u8d77\u6765\u4e86\uff0c\u6240\u4ee5\u5728 CPU \u548c GPU \u5171\u7528\u5185\u5b58\u7684\u65f6\u5019\uff0c\u8981\u9650\u91cf\u4f7f\u7528\uff0c\u800c\u4e0d\u662f\u8ba9 GPU \u65e0\u9650\u5236\u7684\u5360\u7528\u5185\u5b58\uff0c\u53cd\u800c\u6027\u80fd\u4e0d\u9ad8\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u5c31\u662f\u9650\u5236\u5185\u5b58\u7684\u65b9\u6cd5<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">gpus= tf.config.list_physical_devices('GPU')\nif gpus:\n    tf.config.experimental.set_virtual_device_configuration(\n        gpus[0],\n        [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=1024)])  # \u8fd9\u91cc\u662f\u9650\u5236 GPU \u53ef\u7528\u5185\u5b58\u4e3a 1024M = 1GB<\/pre>\n\n\n\n<p>\u9488\u5bf9 TensorFlow 2.x \u6709\u6548\uff0c\u5176\u5b83\u7248\u672c\u7684\u6211\u4e0d\u77e5\u9053\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5bf9\u4e8e\u9ad8\u914d\u7684\u8ba1\u7b97\u673a\uff0c\u53ef\u80fd\u90fd\u4e0d\u7528\u8003\u8651\u9650\u5236\u663e\u5b58\u8fd9\u4e2a\u95ee\u9898\uff0c\u4f46\u662f\u6211\u8981\u8003\u8651\u3002\u6211\u8f7b\u8584\u672c\u5c31 2GB \u72ec\u663e\uff0c\u9ed8\u8ba4\u52a0\u8f7d\u6570\u636e\u65f6\u4f1a\u4e00\u6b21 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-5220","post","type-post","status-publish","format-standard","hentry","category-all"],"modified_by":"IYATT-yx","_links":{"self":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/5220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5220"}],"version-history":[{"count":0,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/5220\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}