Loading

测试a100 torch 配合cuda 能否正常运行

测试程序

# -*- coding: utf-8 -*-
def gpu_test():
    """
    python -c "import uutils; uutils.torch_uu.gpu_test()"
    """
    from torch import Tensor
    import torch

    x = torch.randn(2, 4).cuda()
    y = torch.randn(4, 1).cuda()
    out = (x @ y)
    print(out.shape)
    print('Success, no Cuda errors means it worked see:\n')

gpu_test()

posted @ 2022-12-09 21:29  戴墨镜的长颈鹿  阅读(160)  评论(0编辑  收藏  举报