Is there a way to use weights without using gpuArray

7 ビュー (過去 30 日間)
Marina Ghobrial
Marina Ghobrial 2021 年 7 月 25 日
コメント済み: Marina Ghobrial 2021 年 7 月 27 日
I found this code online and was wondering if there is another way to use it without the gpuArray function. I keep recieving this error when I use it and I am not familiar with gpu:
Error using gpuArray
Failed to load graphics driver. Unable to load library 'nvcuda.dll'. The error was:
The specified module could not be found.
Update or reinstall your graphics driver. For more information on GPU support, see GPU Support by Release.
varSize = 21;
conv1 = convolution2dLayer(5,varSize,'Padding',2,'BiasLearnRateFactor',2);
conv1.Weights = gpuArray(single(randn([5 5 3 varSize])*0.0001));
fc1 = fullyConnectedLayer(64,'BiasLearnRateFactor',2);
fc1.Weights = gpuArray(single(randn([64 576])*0.1));
fc2 = fullyConnectedLayer(4,'BiasLearnRateFactor',2);
fc2.Weights = gpuArray(single(randn([4 64])*0.1));
i want to be able to use convulation neural network and be able to use the weights because I know they help the progrma run faster. so my question is: Is there a way to use weights without using gpuArray?
Thank you
  4 件のコメント
Walter Roberson
Walter Roberson 2021 年 7 月 25 日
varSize = 21;
gpuArray = @(x) x;
conv1 = convolution2dLayer(5,varSize,'Padding',2,'BiasLearnRateFactor',2);
conv1.Weights = gpuArray(single(randn([5 5 3 varSize])*0.0001));
fc1 = fullyConnectedLayer(576,'BiasLearnRateFactor',2);
fc1.Weights = gpuArray(single(randn([576, 64])*0.1));
fc2 = fullyConnectedLayer(4,'BiasLearnRateFactor',2);
fc2.Weights = gpuArray(single(randn([4 64])*0.1))
fc2 =
FullyConnectedLayer with properties: Name: '' Hyperparameters InputSize: 64 OutputSize: 4 Learnable Parameters Weights: [4×64 single] Bias: [] Show all properties
fc1
fc1 =
FullyConnectedLayer with properties: Name: '' Hyperparameters InputSize: 64 OutputSize: 576 Learnable Parameters Weights: [576×64 single] Bias: [] Show all properties
fc2
fc2 =
FullyConnectedLayer with properties: Name: '' Hyperparameters InputSize: 64 OutputSize: 4 Learnable Parameters Weights: [4×64 single] Bias: [] Show all properties
Marina Ghobrial
Marina Ghobrial 2021 年 7 月 27 日
It worked! Thank you so much for all your help!

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeGPU Computing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by