Source: cirosantilli/_file/python/pytorch/matmul.py

= python/pytorch/matmul.py
{file}

<Matrix multiplication> example.

Fundamental since <deep learning is mostly matrix multiplication>.

<NumPy> does not automatically use the <GPU> for it: https://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 <ciro santilli s hardware/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
``