2.Test ML frameworks
One line script to show if tensorflow
or torch
is installed properly on a system(Windows, Linux
).
tenserflow
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
pytorch
python -c "import torch;print(torch.version);print(torch.cuda.is_available());print(torch.rand(3,3).cuda())"
# results
$ python -c "import torch;print(torch.version);print(torch.cuda.is_available());print(torch.rand(3,3).cuda())"
<module 'torch.version' from '.../site-packages/torch/version.py'>
True
tensor([[0.6053, 0.5511, 0.4884],
[0.6022, 0.2012, 0.4289],
[0.9692, 0.2369, 0.2687]], device='cuda:0')