N dimensional multiplication on gpu arrays
Afficher commentaires plus anciens
Is there a better way to compute N dimensional multiplication faster on gpu arrays? I am trying to write a custom deep learning layer which works with gpu array data. However this calculation takes too long for the layer to be meaningfull. Is there a way to do element wise multiplication like this one better on gpu arrays?
A=gpuArray(rand(20,20,16,1000));
B=gpuArray(rand(16,1000));
Z=zeros(size(A),'like',A);
tic
for i=1:16
for j=1:1000
Z(:,:,i,j)=A(:,:,i,j).*B(i,j);
end
end
toc
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Get Started with GPU Coder dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!