OurBigBook About$ Donate
 Sign in Sign up

python/pytorch/matmul.py

Ciro Santilli (@cirosantilli, 37) ... Machine learning Neural network Artificial neural network Deep learning Deep learning framework PyTorch
Updated 2025-07-16  0 By others on same topic  0 Discussions Create my own version
(root) / python / pytorch / matmul.py
Matrix multiplication example.
Fundamental since deep learning is mostly matrix multiplication.
NumPy does not automatically use the GPU for it: stackoverflow.com/questions/49605231/does-numpy-automatically-detect-and-use-gpu, and PyTorch is one of the most notable compatible implementations, as it uses the same memory structure as NumPy arrays.
Sample runs on P51 to observe the GPU speedup:
$ time ./matmul.py g 10000 1000 10000 100
real    0m22.980s
user    0m22.679s
sys     0m1.129s
$ time ./matmul.py c 10000 1000 10000 100
real    1m9.924s
user    4m16.213s
sys     0m17.293s

 Ancestors (11)

  1. PyTorch
  2. Deep learning framework
  3. Deep learning
  4. Artificial neural network
  5. Neural network
  6. Machine learning
  7. Computer
  8. Information technology
  9. Area of technology
  10. Technology
  11.  Home

 View article source

 Discussion (0)

New discussion

There are no discussions about this article yet.

 Articles by others on the same topic (0)

There are currently no matching articles.
  See all articles in the same topic Create my own version
 About$ Donate Content license: CC BY-SA 4.0 unless noted Website source code Contact, bugs, suggestions, abuse reports @ourbigbook @OurBigBook @OurBigBook