設備 普通 JS WebGL Wasm Wasm+SIMD Wasm+SIMD+線程 Pixel 4 368 28 28 15.9 N\/A* 第 6 代 ThnkPad X1,Linux 301.0 25 15 7.3 4.1 MacBook Pro 15 2019 209.1 22.7 13.3 7.9 4.0 在 MacBook Pro 15 2019 上運行 Node v.14 201.2 N\/A 25.5 15.2 N\/A**"}}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"更大的模型,如 MobileNet V2,這是一個擁有 350 萬個參數和大約 3 億個乘加運算的中性模型,可以獲得更快的加速:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"embedcomp","attrs":{"type":"table","data":{"content":" 設備 普通 JS WebGL Wasm Wasm+SIMD Wasm+SIMD+線程 Pixel 4 1628 76.7 182 82 N\/A* 第 6 代 ThinkPad X1,Linux 1489 44.8 122.7 34.6 12.4 MacBook Pro 15 2019 893.5 19.6 98.4 30.2 10.3 在 MacBook Pro 15 2019shang yunxing Node v.14 1404.3 N\/A 290.0 64.2 N\/A**"}}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"注:"},{"type":"link","attrs":{"href":"https:\/\/www.chromestatus.com\/feature\/5724132452859904","title":"","type":null},"content":[{"type":"text","text":"由於移動瀏覽器中的多線程支持仍在進行中"}]},{"type":"text","text":",故 Pixel 4 不支持 TF.js 多線程 Wasm 後端的基準測試。iOS 版本的 SIMD 支持也仍在開發中。TF.js 多線程 Wasm 後端的節點支持即將推出。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]} |
使用 SIMD 和多線程增強 TensorFlow.js WebAssembly 後端
{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"本文最初發表在 TensorFlow 官博,經原作者授權,InfoQ 中文站翻譯並分享。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"今年三月,我們爲 TensorFlow.js "},{"type":"link","attrs":{"href":"https:\/\/blog.tensorflow.org\/2020\/03\/introducing-webassembly-backend-for-tensorflow-js.html","title":"","type":null},"content":[{"type":"text","text":"引入"}]},{"type":"text","text":"了一個新的 WebAssembly(Wasm)加速後端。今天,我們很高興的宣佈一個重大的性能更新:從 TensorFlow.js 2.3.0 版本開始,通過 "},{"type":"link","attrs":{"href":"https:\/\/github.com\/google\/XNNPACK","title":"","type":null},"content":[{"type":"text","text":"XNNPACK"}]},{"type":"text","text":"(一個高度優化的神經網絡運算符庫)利用"},{"type":"link","attrs":{"href":"https:\/\/github.com\/WebAssembly\/simd","title":"","type":null},"content":[{"type":"text","text":" SIMD(向量)指令"}]},{"type":"text","text":"和"},{"type":"link","attrs":{"href":"https:\/\/github.com\/WebAssembly\/threads","title":"","type":null},"content":[{"type":"text","text":"多線程"}]},{"type":"text","text":",我們的 Wasm 後端速度提高了 10 倍。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"基準測試"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"SIMD 和多線程爲我們的 Wasm 後端帶來了重大的性能提升。下面是 Google Chrome 瀏覽器的基準測試,展示了 "},{"type":"link","attrs":{"href":"https:\/\/github.com\/tensorflow\/tfjs-models\/tree\/master\/blazeface","title":"","type":null},"content":[{"type":"text","text":"BlazeFace"}]},{"type":"text","text":" 的改進。BlazeFace 是一個具有 10 萬個參數和大約 2000 萬次乘加運算的輕量級模型。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"(表中所列出的時間爲每次推斷的毫秒數)"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"embedcomp","attrs":{"type":"table","data":{"content":"
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.