フィルターのクリア

How can we train using gpu instead of cpu ?

3 ビュー (過去 30 日間)
Hamza Afzal
Hamza Afzal 2021 年 2 月 26 日
コメント済み: Joss Knight 2021 年 3 月 8 日
Data:
I am using this example, i want to train the network using gpu.
Problem:
Where in the code, i can specify that training should be done using gpu?
Is there a code line or any functions that does this ?

採用された回答

Joss Knight
Joss Knight 2021 年 3 月 8 日
By default your GPU will be used if you have one. To force it, set the ExecutionEnvironment training option to 'gpu'.
  2 件のコメント
Hamza Afzal
Hamza Afzal 2021 年 3 月 8 日
ExecutionEnvironment = 'gpu'
Do we have to write this code line in the code(program) ?
Joss Knight
Joss Knight 2021 年 3 月 8 日
Ah, my mistake. This is a custom training loop. In this case, the simplest way to force GPU behaviour is to set the OutputEnvironment option on the minibatchqueue object mbqTrain when it is created. For best performance, you should also move the dlnetwork object to the GPU:
net = dlupdate(@gpuArray, net);
You can do this inside the training code, just before if doTraining.
But what I said before holds true - this training code will run on the GPU as it is because that is the way the default settings work.
For inference, you can see that the section Detect objects Using YOLO v3 takes pains to show you how to run on the GPU.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by