Advertisement
dachte

test_cuda_tf2.py

Jan 29th, 2023
786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 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. with tf.compat.v1.Graph().as_default():
  9.         m1 = tf.constant([[1.0, 2.0]])
  10.         m2 = tf.constant([[3.0], [4.0]])
  11.         product = tf.matmul(m1, m2)
  12.  
  13.         with tf.compat.v1.Session() as session:
  14.                 result = session.run(product)
  15.  
  16.         print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement