zoukankan      html  css  js  c++  java
  • Spyder应用技巧

      ————解决PyTorch的相关问题

       

            PyTorch是一个开源的Python机器学习库,基于Torch,用于自然语言处理等应用程序。2017年1月,由Facebook人工智能研究院(FAIR)基于Torch推出了PyTorch。它是一个基于Python的可续计算包,提供两个高级功能:1、具有强大的GPU加速的张量计算(如NumPy)2、包含自动求导系统的深度神经网络
              我个人觉得开发python语言,用Spyder还是蛮好用,它是python的发明人开发的。在用的当中,有几个问题,
        1)加入参数如图:
        Run=>Run configuration per file,勾选 Command line options(注意参数前有--)
         

    2)如果PyTorch是CPU方式,可以改_ _init.py_ _:

    def set_device(device: _device_t) -> None:
    r"""Sets the current device.
    
    Usage of this function is discouraged in favor of :any:`device`. In most
    cases it's better to use ``CUDA_VISIBLE_DEVICES`` environmental variable.
    
    Args:
    device (torch.device or int): selected device. This function is a no-op
    if this argument is negative.
    """
    device = _get_device_index(device)
    if device >= 0:
    #torch._C._cuda_setDevice(device)
    torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
    

     最后通过搜索“Win10+Anaconda安装CPU版本Pytorch与GPU版Pytorch”,找到相关的测试程序。

    ,Best Wish 不负年华
  • 相关阅读:
    条码解析的一片js
    再看.net本质(二)
    再看.net本质
    powerdesigner逆向导出oracle数据库结构显示备注
    powerdesigner逆向工程,从数据库导出PDM
    实现HTTP跳转到HTTPS
    opencart 模块开发详解
    Opencart 之 Registry 类详解
    OpenCart 之registry功用
    php+支付宝整合
  • 原文地址:https://www.cnblogs.com/shiningleo007/p/14962583.html
Copyright © 2011-2022 走看看