Skip to content

Instantly share code, notes, and snippets.

@aliencaocao
Created July 1, 2022 09:48
Show Gist options
  • Save aliencaocao/d21eb856c71e801ab958750f1b31a038 to your computer and use it in GitHub Desktop.
Save aliencaocao/d21eb856c71e801ab958750f1b31a038 to your computer and use it in GitHub Desktop.
TensorFlow test if using GPU
import tensorflow as tf
print(tf.config.list_physical_devices('GPU'))
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
print(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment