最近專案,需要創建一個 tensorflow 的一個自定義操作,用來加速tensorflow的處理效果;下面對創建程序中,遇到的問題和資源進行簡要記錄,進行備忘:
OP 創建 參考鏈接:
https://www.tensorflow.org/guide/create_op (官方教程)
Tensorflow上手3: 實作自己的Op
https://github.com/tensorflow/custom-op (官方模板,看完上面的教程,使用該模板就可以很方便得在docker 容器中進行嘗試構建;較為推薦)
何時定義一個新的OP:
- 現有的operation 組合不出來需要的OP;
- 現有的operation 組合出來的OP 十分低效;
- 你想要融合一些操作來提高效率;
保持更新,轉載請注明出處;更多內容請關注 cnblogs.com/xuyaowen;
安裝測驗docker(用于gpu環境docker測驗):
docker pull tensorflow/tensorflow:custom-op-gpu-ubuntu16
docker run --runtime=nvidia --privileged -it -v ${PWD}:/working_dir -w /working_dir tensorflow/tensorflow:custom-op-gpu-ubuntu16
安裝測驗docker(用于cpu環境docker測驗):
docker pull tensorflow/tensorflow:custom-op-ubuntu16
docker run -it -v ${PWD}:/working_dir -w /working_dir tensorflow/tensorflow:custom-op-ubuntu16
docker run -it tensorflow/tensorflow:custom-op-ubuntu16 /bin/bash
使用清華鏡像臨時下載pip安裝包:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/89842.html
標籤:C++
上一篇:清北學堂day3
下一篇:多重背包問題
