Advertisement
dachte

test_cuda.py

Jan 29th, 2023
789
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import tensorflow as tf
  4.  
  5. from tensorflow.python.client import device_lib
  6. print(str(device_lib.list_local_devices() ))
  7.  
  8. m1 = tf.constant([[1.0, 2.0]])
  9. m2 = tf.constant([[3.0], [4.0]])
  10. product = tf.matmul(m1, m2)
  11.  
  12. with tf.Session() as session:
  13.         result = session.run(product)
  14.  
  15. print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement