gpu.png

import tensorflow as tf

if __name__ == '__main__':
    tf.debugging.set_log_device_placement(True)
    a = tf.constant([[1.0,2.0,3.0],[4.0,5.0,6.0]])
    b = tf.constant([[1.0,2.0],[3.0,4.0],[5.0,6.0]])
    c = tf.matmul(a,b)
    print(c)
import torch

USE_CUDA = torch.cuda.is_available()
print(USE_CUDA)

device = torch.device('cuda:0' if USE_CUDA else 'cpu')
print('학습을 진행하는 기기:',device)