關於torch的常用指令

2021-10-23 09:49:30 字數 1176 閱讀 6569

我們主要講解如何所以pip,conda更新pytorch和torchvision,這樣你就可以使用ubuntu,centos,mac更新pytorch和torchvision

1、使用pip更新pytorch和torchvision

# 列舉pip當前可以更新的所有安裝包

pip list --outdated --format=legacy

# 更新pytorch和torchvision安裝包

pip install --upgrade pytorch torchvision

2、使用conda更新pytorch和torchvision

# 建議將其新增soumith為您的anaconda(或miniconda)的源伺服器

conda config --add channels soumith

# 更新pytorch和torchvision安裝包

conda update pytorch torchvision

3、解除安裝pytorch重新安裝

如果上面的方法無法更新pytorch,您可以解除安裝再重新安裝pytorch,解除安裝方法如下:

pip uninstall torch
安裝可以參考pytorch如何安裝,linux的安裝pytorch,osx安裝pytorch教程

使用conda安裝指定版本

# 比如我們安裝 v0.1.10

conda install pytorch=0.1.10 -c soumith

使用pip安裝指定版本

pip install pytorch==0.1.10
1、使用conda解除安裝pytorch

conda uninstall pytorch

conda uninstall libtorch

2、使用pip解除安裝pytorch

pip uninstall torch
有時候我們想要知道當前的pytorch版本,我們可以使用如下**列印出當前的版本:

import torch

print(torch.__version__)

原文出處:

關於postgresql 常用操作指令

關於postgresql 常用操作指令 建立資料庫 create database test with owner postgres encoding utf8 進入控制台方法,在postgresql的安裝目的bin下執行命令 psql 資料庫名,例 usr local pgsql bin psql...

關於torch的一些記錄

int型tensor from torch.autograd import variable from torch import inttensor var variable inttensor 1,0 0,1 檢視size var.size torch.size 2,2 將var.size 轉換為...

關於Ubuntu 常用的簡單指令

這幾天工作強度不算太高,就自己學了一下linux,我就把一些簡單的指令整理了一下,希望以後有參考 我是用的vmware 安裝的ubuntu 虛擬機器 下面直接貼出我整理的簡單的日常使用的指令 建立檔案 touch 檔名 建立資料夾 madir 檔名 檢視檔案內容 部分 cat 檔名 檢視檔案內容 全...