(pytorch_env) PS E:\PyTorch_Build\pytorch> # 安装支持 sm_120 架构的 PyTorch Nightly 版本
(pytorch_env) PS E:\PyTorch_Build\pytorch> pip uninstall -y torch torchvision torchaudio
Found existing installation: torch 2.3.0+cu121
Uninstalling torch-2.3.0+cu121:
Successfully uninstalled torch-2.3.0+cu121
Found existing installation: torchvision 0.18.0+cu121
Uninstalling torchvision-0.18.0+cu121:
Successfully uninstalled torchvision-0.18.0+cu121
Found existing installation: torchaudio 2.3.0+cu121
Uninstalling torchaudio-2.3.0+cu121:
Successfully uninstalled torchaudio-2.3.0+cu121
(pytorch_env) PS E:\PyTorch_Build\pytorch> pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121
Looking in indexes: https://download.pytorch.org/whl/nightly/cu121
Collecting torch
Using cached https://download.pytorch.org/whl/nightly/cu121/torch-2.6.0.dev20241112%2Bcu121-cp310-cp310-win_amd64.whl (2456.2 MB)
Collecting torchvision
Using cached https://download.pytorch.org/whl/nightly/cu121/torchvision-0.20.0.dev20241112%2Bcu121-cp310-cp310-win_amd64.whl (6.2 MB)
Collecting torchaudio
Using cached https://download.pytorch.org/whl/nightly/cu121/torchaudio-2.5.0.dev20241112%2Bcu121-cp310-cp310-win_amd64.whl (4.2 MB)
Requirement already satisfied: filelock in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from torch) (3.19.1)
Requirement already satisfied: typing-extensions>=4.10.0 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from torch) (4.15.0)
Requirement already satisfied: networkx in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from torch) (3.4.2)
Requirement already satisfied: jinja2 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from torch) (3.1.6)
Requirement already satisfied: fsspec in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from torch) (2025.7.0)
Requirement already satisfied: sympy==1.13.1 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from torch) (1.13.1)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from sympy==1.13.1->torch) (1.3.0)
Requirement already satisfied: numpy in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from torchvision) (2.1.2)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from torchvision) (11.0.0)
Requirement already satisfied: MarkupSafe>=2.0 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from jinja2->torch) (3.0.2)
Installing collected packages: torch, torchvision, torchaudio
Successfully installed torch-2.6.0.dev20241112+cu121 torchaudio-2.5.0.dev20241112+cu121 torchvision-0.20.0.dev20241112+cu121
(pytorch_env) PS E:\PyTorch_Build\pytorch>
(pytorch_env) PS E:\PyTorch_Build\pytorch> # 或者从源码编译支持 sm_120
(pytorch_env) PS E:\PyTorch_Build\pytorch> git clone --depth 1 --branch release/2.4 https://github.com/pytorch/pytorch
Cloning into 'pytorch'...
remote: Enumerating objects: 11178, done.
remote: Counting objects: 100% (11178/11178), done.
remote: Compressing objects: 100% (9646/9646), done.
remote: Total 11178 (delta 1404), reused 6483 (delta 1248), pack-reused 0 (from 0)
Receiving objects: 100% (11178/11178), 99.55 MiB | 2.38 MiB/s, done.
Resolving deltas: 100% (1404/1404), done.
Updating files: 100% (15987/15987), done.
(pytorch_env) PS E:\PyTorch_Build\pytorch> cd pytorch
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> pip install -r requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Ignoring setuptools: markers 'python_version >= "3.12"' don't match your environment
Collecting astunparse (from -r requirements.txt (line 2))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Collecting expecttest!=0.2.0 (from -r requirements.txt (line 3))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/27/fb/deeefea1ea549273817ca7bed3db2f39cc238a75a745a20e3651619f7335/expecttest-0.3.0-py3-none-any.whl (8.2 kB)
Collecting hypothesis (from -r requirements.txt (line 4))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f7/fb/0eca64797a914b73a3601ed0c8941764d0b4232a4900eb03502e1daf8407/hypothesis-6.138.11-py3-none-any.whl (533 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 533.4/533.4 kB 17.0 MB/s 0:00:00
Requirement already satisfied: numpy in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 5)) (2.1.2)
Collecting psutil (from -r requirements.txt (line 6))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/50/1b/6921afe68c74868b4c9fa424dad3be35b095e16687989ebbb50ce4fceb7c/psutil-7.0.0-cp37-abi3-win_amd64.whl (244 kB)
Requirement already satisfied: pyyaml in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 7)) (6.0.2)
Collecting requests (from -r requirements.txt (line 8))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/1e/db/4254e3eabe8020b458f1a747140d32277ec7a271daf1d235b70dc0b4e6e3/requests-2.32.5-py3-none-any.whl (64 kB)
Requirement already satisfied: setuptools in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 9)) (80.9.0)
Collecting types-dataclasses (from -r requirements.txt (line 10))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/31/85/23ab2bbc280266af5bf22ded4e070946d1694d1721ced90666b649eaa795/types_dataclasses-0.6.6-py3-none-any.whl (2.9 kB)
Requirement already satisfied: typing-extensions>=4.8.0 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 11)) (4.15.0)
Requirement already satisfied: sympy in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 12)) (1.13.1)
Requirement already satisfied: filelock in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 13)) (3.19.1)
Requirement already satisfied: networkx in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 14)) (3.4.2)
Requirement already satisfied: jinja2 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 15)) (3.1.6)
Requirement already satisfied: fsspec in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 16)) (2025.7.0)
Collecting lintrunner (from -r requirements.txt (line 17))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/40/c1/eb0184a324dd25e19b84e52fc44c6262710677737c8acca5d545b3d25ffb/lintrunner-0.12.7-py3-none-win_amd64.whl (1.7 MB)
Requirement already satisfied: ninja in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from -r requirements.txt (line 18)) (1.13.0)
Collecting packaging (from -r requirements.txt (line 21))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl (66 kB)
Collecting optree>=0.11.0 (from -r requirements.txt (line 22))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/74/fa/83d4cd387043483ee23617b048829a1289bf54afe2f6cb98ec7b27133369/optree-0.17.0-cp310-cp310-win_amd64.whl (304 kB)
Requirement already satisfied: wheel<1.0,>=0.23.0 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from astunparse->-r requirements.txt (line 2)) (0.45.1)
Collecting six<2.0,>=1.6.1 (from astunparse->-r requirements.txt (line 2))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl (11 kB)
Collecting attrs>=22.2.0 (from hypothesis->-r requirements.txt (line 4))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl (63 kB)
Collecting exceptiongroup>=1.0.0 (from hypothesis->-r requirements.txt (line 4))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/36/f4/c6e662dade71f56cd2f3735141b265c3c79293c109549c1e6933b0651ffc/exceptiongroup-1.3.0-py3-none-any.whl (16 kB)
Collecting sortedcontainers<3.0.0,>=2.1.0 (from hypothesis->-r requirements.txt (line 4))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/32/46/9cb0e58b2deb7f82b84065f37f3bffeb12413f947f9388e4cac22c4621ce/sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB)
Collecting charset_normalizer<4,>=2 (from requests->-r requirements.txt (line 8))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e2/c6/f05db471f81af1fa01839d44ae2a8bfeec8d2a8b4590f16c4e7393afd323/charset_normalizer-3.4.3-cp310-cp310-win_amd64.whl (107 kB)
Collecting idna<4,>=2.5 (from requests->-r requirements.txt (line 8))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl (70 kB)
Collecting urllib3<3,>=1.21.1 (from requests->-r requirements.txt (line 8))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a7/c2/fe1e52489ae3122415c51f387e221dd0773709bad6c6cdaa599e8a2c5185/urllib3-2.5.0-py3-none-any.whl (129 kB)
Collecting certifi>=2017.4.17 (from requests->-r requirements.txt (line 8))
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e5/48/1549795ba7742c948d2ad169c1c8cdbae65bc450d6cd753d124b17c8cd32/certifi-2025.8.3-py3-none-any.whl (161 kB)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from sympy->-r requirements.txt (line 12)) (1.3.0)
Requirement already satisfied: MarkupSafe>=2.0 in e:\pytorch_build\pytorch\pytorch_env\lib\site-packages (from jinja2->-r requirements.txt (line 15)) (3.0.2)
Installing collected packages: types-dataclasses, sortedcontainers, urllib3, six, psutil, packaging, optree, lintrunner, idna, expecttest, exceptiongroup, charset_normalizer, certifi, attrs, requests, hypothesis, astunparse
Successfully installed astunparse-1.6.3 attrs-25.3.0 certifi-2025.8.3 charset_normalizer-3.4.3 exceptiongroup-1.3.0 expecttest-0.3.0 hypothesis-6.138.11 idna-3.10 lintrunner-0.12.7 optree-0.17.0 packaging-25.0 psutil-7.0.0 requests-2.32.5 six-1.17.0 sortedcontainers-2.4.0 types-dataclasses-0.6.6 urllib3-2.5.0
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch>
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> # 设置计算能力环境变量
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> $env:TORCH_CUDA_ARCH_LIST="8.9;9.0" # RTX 5070 需要 8.9+
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch>
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> # 开始编译
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> python setup.py install
Building wheel torch-2.4.0a0+gitee1b680
-- Building version 2.4.0a0+gitee1b680
--- Trying to initialize submodules
Submodule 'android/libs/fbjni' (https://github.com/facebookincubator/fbjni.git) registered for path 'android/libs/fbjni'
Submodule 'third_party/NNPACK_deps/FP16' (https://github.com/Maratyszcza/FP16.git) registered for path 'third_party/FP16'
Submodule 'third_party/NNPACK_deps/FXdiv' (https://github.com/Maratyszcza/FXdiv.git) registered for path 'third_party/FXdiv'
Submodule 'third_party/NNPACK' (https://github.com/Maratyszcza/NNPACK.git) registered for path 'third_party/NNPACK'
Submodule 'third_party/VulkanMemoryAllocator' (https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git) registered for path 'third_party/VulkanMemoryAllocator'
Submodule 'third_party/XNNPACK' (https://github.com/google/XNNPACK.git) registered for path 'third_party/XNNPACK'
Submodule 'third_party/benchmark' (https://github.com/google/benchmark.git) registered for path 'third_party/benchmark'
Submodule 'third_party/cpp-httplib' (https://github.com/yhirose/cpp-httplib.git) registered for path 'third_party/cpp-httplib'
Submodule 'third_party/cpuinfo' (https://github.com/pytorch/cpuinfo.git) registered for path 'third_party/cpuinfo'
Submodule 'third_party/cudnn_frontend' (https://github.com/NVIDIA/cudnn-frontend.git) registered for path 'third_party/cudnn_frontend'
Submodule 'third_party/cutlass' (https://github.com/NVIDIA/cutlass.git) registered for path 'third_party/cutlass'
Submodule 'third_party/eigen' (https://gitlab.com/libeigen/eigen.git) registered for path 'third_party/eigen'
Submodule 'third_party/fbgemm' (https://github.com/pytorch/fbgemm) registered for path 'third_party/fbgemm'
Submodule 'third_party/flatbuffers' (https://github.com/google/flatbuffers.git) registered for path 'third_party/flatbuffers'
Submodule 'third_party/fmt' (https://github.com/fmtlib/fmt.git) registered for path 'third_party/fmt'
Submodule 'third_party/foxi' (https://github.com/houseroad/foxi.git) registered for path 'third_party/foxi'
Submodule 'third_party/gemmlowp/gemmlowp' (https://github.com/google/gemmlowp.git) registered for path 'third_party/gemmlowp/gemmlowp'
Submodule 'third_party/gloo' (https://github.com/facebookincubator/gloo) registered for path 'third_party/gloo'
Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/googletest'
Submodule 'third_party/ideep' (https://github.com/intel/ideep) registered for path 'third_party/ideep'
Submodule 'third_party/ittapi' (https://github.com/intel/ittapi.git) registered for path 'third_party/ittapi'
Submodule 'third_party/kineto' (https://github.com/pytorch/kineto) registered for path 'third_party/kineto'
Submodule 'third_party/mimalloc' (https://github.com/microsoft/mimalloc.git) registered for path 'third_party/mimalloc'
Submodule 'third_party/nccl/nccl' (https://github.com/NVIDIA/nccl) registered for path 'third_party/nccl/nccl'
Submodule 'third_party/nlohmann' (https://github.com/nlohmann/json.git) registered for path 'third_party/nlohmann'
Submodule 'third_party/onnx' (https://github.com/onnx/onnx.git) registered for path 'third_party/onnx'
Submodule 'third_party/opentelemetry-cpp' (https://github.com/open-telemetry/opentelemetry-cpp.git) registered for path 'third_party/opentelemetry-cpp'
Submodule 'third_party/pocketfft' (https://github.com/mreineck/pocketfft) registered for path 'third_party/pocketfft'
Submodule 'third_party/protobuf' (https://github.com/protocolbuffers/protobuf.git) registered for path 'third_party/protobuf'
Submodule 'third_party/NNPACK_deps/psimd' (https://github.com/Maratyszcza/psimd.git) registered for path 'third_party/psimd'
Submodule 'third_party/NNPACK_deps/pthreadpool' (https://github.com/Maratyszcza/pthreadpool.git) registered for path 'third_party/pthreadpool'
Submodule 'third_party/pybind11' (https://github.com/pybind/pybind11.git) registered for path 'third_party/pybind11'
Submodule 'third_party/python-peachpy' (https://github.com/malfet/PeachPy.git) registered for path 'third_party/python-peachpy'
Submodule 'third_party/sleef' (https://github.com/shibatch/sleef) registered for path 'third_party/sleef'
Submodule 'third_party/tensorpipe' (https://github.com/pytorch/tensorpipe.git) registered for path 'third_party/tensorpipe'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/android/libs/fbjni'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/FP16'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/FXdiv'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/NNPACK'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/VulkanMemoryAllocator'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/XNNPACK'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/benchmark'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/cpp-httplib'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/cpuinfo'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/cudnn_frontend'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/cutlass'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/eigen'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/fbgemm'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/flatbuffers'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/fmt'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/foxi'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/gemmlowp/gemmlowp'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/gloo'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/googletest'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/ideep'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/ittapi'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/mimalloc'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/nccl/nccl'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/nlohmann'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/onnx'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/pocketfft'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/protobuf'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/psimd'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/pthreadpool'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/pybind11'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/python-peachpy'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/sleef'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/tensorpipe'...
Submodule path 'android/libs/fbjni': checked out '7e1e1fe3858c63c251c637ae41a20de425dde96f'
Submodule path 'third_party/FP16': checked out '4dfe081cf6bcd15db339cf2680b9281b8451eeb3'
Submodule path 'third_party/FXdiv': checked out 'b408327ac2a15ec3e43352421954f5b1967701d1'
Submodule path 'third_party/NNPACK': checked out 'c07e3a0400713d546e0dea2d5466dd22ea389c73'
Submodule path 'third_party/VulkanMemoryAllocator': checked out 'a6bfc237255a6bac1513f7c1ebde6d8aed6b5191'
Submodule path 'third_party/XNNPACK': checked out 'fcbf55af6cf28a4627bcd1f703ab7ad843f0f3a2'
Submodule path 'third_party/benchmark': checked out '0d98dba29d66e93259db7daa53a9327df767a415'
Submodule path 'third_party/cpp-httplib': checked out '3b6597bba913d51161383657829b7e644e59c006'
Submodule path 'third_party/cpuinfo': checked out 'd6860c477c99f1fce9e28eb206891af3c0e1a1d7'
Submodule path 'third_party/cudnn_frontend': checked out 'b740542818f36857acf7f9853f749bbad4118c65'
Submodule path 'third_party/cutlass': checked out 'bbe579a9e3beb6ea6626d9227ec32d0dae119a49'
Submodule path 'third_party/eigen': checked out '3147391d946bb4b6c68edd901f2add6ac1f31f8c'
Submodule path 'third_party/fbgemm': checked out 'dbc3157bf256f1339b3fa1fef2be89ac4078be0e'
Submodule 'third_party/asmjit' (https://github.com/asmjit/asmjit.git) registered for path 'third_party/fbgemm/third_party/asmjit'
Submodule 'third_party/cpuinfo' (https://github.com/pytorch/cpuinfo) registered for path 'third_party/fbgemm/third_party/cpuinfo'
Submodule 'third_party/cutlass' (https://github.com/NVIDIA/cutlass.git) registered for path 'third_party/fbgemm/third_party/cutlass'
Submodule 'third_party/googletest' (https://github.com/google/googletest) registered for path 'third_party/fbgemm/third_party/googletest'
Submodule 'third_party/hipify_torch' (https://github.com/ROCmSoftwarePlatform/hipify_torch.git) registered for path 'third_party/fbgemm/third_party/hipify_torch'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/fbgemm/third_party/asmjit'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/fbgemm/third_party/cpuinfo'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/fbgemm/third_party/cutlass'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/fbgemm/third_party/googletest'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/fbgemm/third_party/hipify_torch'...
Submodule path 'third_party/fbgemm/third_party/asmjit': checked out 'd3fbf7c9bc7c1d1365a94a45614b91c5a3706b81'
Submodule path 'third_party/fbgemm/third_party/cpuinfo': checked out 'ed8b86a253800bafdb7b25c5c399f91bff9cb1f3'
Submodule path 'third_party/fbgemm/third_party/cutlass': checked out 'fc9ebc645b63f3a6bc80aaefde5c063fb72110d6'
Submodule path 'third_party/fbgemm/third_party/googletest': checked out 'cbf019de22c8dd37b2108da35b2748fd702d1796'
Submodule path 'third_party/fbgemm/third_party/hipify_torch': checked out '23f53b025b466d8ec3c45d52290d3442f7fbe6b1'
Submodule path 'third_party/flatbuffers': checked out '01834de25e4bf3975a9a00e816292b1ad0fe184b'
Submodule path 'third_party/fmt': checked out 'e69e5f977d458f2650bb346dadf2ad30c5320281'
Submodule path 'third_party/foxi': checked out 'c278588e34e535f0bb8f00df3880d26928038cad'
Submodule path 'third_party/gemmlowp/gemmlowp': checked out '3fb5c176c17c765a3492cd2f0321b0dab712f350'
Submodule path 'third_party/gloo': checked out '5354032ea08eadd7fc4456477f7f7c6308818509'
Submodule path 'third_party/googletest': checked out 'e2239ee6043f73722e7aa812a459f54a28552929'
Submodule path 'third_party/ideep': checked out '55ca0191687aaf19aca5cdb7881c791e3bea442b'
Submodule 'mkl-dnn' (https://github.com/intel/mkl-dnn.git) registered for path 'third_party/ideep/mkl-dnn'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/ideep/mkl-dnn'...
Submodule path 'third_party/ideep/mkl-dnn': checked out '1137e04ec0b5251ca2b4400a4fd3c667ce843d67'
Submodule path 'third_party/ittapi': checked out '5b8a7d7422611c3a0d799fb5fc5dd4abfae35b42'
Submodule path 'third_party/kineto': checked out 'be1317644c68b4bfc4646024a6b221066e430031'
Submodule 'libkineto/third_party/dynolog' (https://github.com/facebookincubator/dynolog.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog'
Submodule 'libkineto/third_party/fmt' (https://github.com/fmtlib/fmt.git) registered for path 'third_party/kineto/libkineto/third_party/fmt'
Submodule 'libkineto/third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/kineto/libkineto/third_party/googletest'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/fmt'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/googletest'...
Submodule path 'third_party/kineto/libkineto/third_party/dynolog': checked out '7d04a0053a845370ae06ce317a22a48e9edcc74e'
Submodule 'third_party/DCGM' (https://github.com/NVIDIA/DCGM.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog/third_party/DCGM'
Submodule 'third_party/cpr' (https://github.com/libcpr/cpr.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog/third_party/cpr'
Submodule 'third_party/fmt' (https://github.com/fmtlib/fmt.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog/third_party/fmt'
Submodule 'third_party/gflags' (https://github.com/gflags/gflags.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog/third_party/gflags'
Submodule 'third_party/glog' (https://github.com/google/glog.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog/third_party/glog'
Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog/third_party/googletest'
Submodule 'third_party/json' (https://github.com/nlohmann/json.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog/third_party/json'
Submodule 'third_party/pfs' (https://github.com/dtrugman/pfs.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog/third_party/pfs'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/DCGM'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/cpr'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/fmt'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/gflags'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/glog'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/googletest'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/json'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/pfs'...
Submodule path 'third_party/kineto/libkineto/third_party/dynolog/third_party/DCGM': checked out 'ffde4e54bc7249a6039a5e6b45b395141e1217f9'
Submodule path 'third_party/kineto/libkineto/third_party/dynolog/third_party/cpr': checked out '871ed52d350214a034f6ef8a3b8f51c5ce1bd400'
Submodule path 'third_party/kineto/libkineto/third_party/dynolog/third_party/fmt': checked out 'cd4af11efc9c622896a3e4cb599fa28668ca3d05'
Submodule path 'third_party/kineto/libkineto/third_party/dynolog/third_party/gflags': checked out 'e171aa2d15ed9eb17054558e0b3a6a413bb01067'
Submodule 'doc' (https://github.com/gflags/gflags.git) registered for path 'third_party/kineto/libkineto/third_party/dynolog/third_party/gflags/doc'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/gflags/doc'...
Submodule path 'third_party/kineto/libkineto/third_party/dynolog/third_party/gflags/doc': checked out '8411df715cf522606e3b1aca386ddfc0b63d34b4'
Submodule path 'third_party/kineto/libkineto/third_party/dynolog/third_party/glog': checked out 'b33e3bad4c46c8a6345525fd822af355e5ef9446'
Submodule path 'third_party/kineto/libkineto/third_party/dynolog/third_party/googletest': checked out '58d77fa8070e8cec2dc1ed015d66b454c8d78850'
Submodule path 'third_party/kineto/libkineto/third_party/dynolog/third_party/json': checked out '4f8fba14066156b73f1189a2b8bd568bde5284c5'
Submodule path 'third_party/kineto/libkineto/third_party/dynolog/third_party/pfs': checked out 'f68a2fa8ea36c783bdd760371411fcb495aa3150'
Submodule path 'third_party/kineto/libkineto/third_party/fmt': checked out 'a33701196adfad74917046096bf5a2aa0ab0bb50'
Submodule path 'third_party/kineto/libkineto/third_party/googletest': checked out '7aca84427f224eeed3144123d5230d5871e93347'
Submodule path 'third_party/mimalloc': checked out 'b66e3214d8a104669c2ec05ae91ebc26a8f5ab78'
Submodule path 'third_party/nccl/nccl': checked out '48bb7fec7953112ff37499a272317f6663f8f600'
Submodule path 'third_party/nlohmann': checked out '87cda1d6646592ac5866dc703c8e1839046a6806'
Submodule path 'third_party/onnx': checked out '990217f043af7222348ca8f0301e17fa7b841781'
Submodule 'third_party/benchmark' (https://github.com/google/benchmark.git) registered for path 'third_party/onnx/third_party/benchmark'
Submodule 'third_party/pybind11' (https://github.com/pybind/pybind11.git) registered for path 'third_party/onnx/third_party/pybind11'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/onnx/third_party/benchmark'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/onnx/third_party/pybind11'...
Submodule path 'third_party/onnx/third_party/benchmark': checked out '2dd015dfef425c866d9a43f2c67d8b52d709acb6'
Submodule path 'third_party/onnx/third_party/pybind11': checked out '5b0a6fc2017fcc176545afe3e09c9f9885283242'
Submodule path 'third_party/opentelemetry-cpp': checked out 'a799f4aed9c94b765dcdaabaeab7d5e7e2310878'
Submodule 'third_party/benchmark' (https://github.com/google/benchmark) registered for path 'third_party/opentelemetry-cpp/third_party/benchmark'
Submodule 'third_party/googletest' (https://github.com/google/googletest) registered for path 'third_party/opentelemetry-cpp/third_party/googletest'
Submodule 'third_party/ms-gsl' (https://github.com/microsoft/GSL) registered for path 'third_party/opentelemetry-cpp/third_party/ms-gsl'
Submodule 'third_party/nlohmann-json' (https://github.com/nlohmann/json) registered for path 'third_party/opentelemetry-cpp/third_party/nlohmann-json'
Submodule 'third_party/opentelemetry-proto' (https://github.com/open-telemetry/opentelemetry-proto) registered for path 'third_party/opentelemetry-cpp/third_party/opentelemetry-proto'
Submodule 'third_party/opentracing-cpp' (https://github.com/opentracing/opentracing-cpp.git) registered for path 'third_party/opentelemetry-cpp/third_party/opentracing-cpp'
Submodule 'third_party/prometheus-cpp' (https://github.com/jupp0r/prometheus-cpp) registered for path 'third_party/opentelemetry-cpp/third_party/prometheus-cpp'
Submodule 'tools/vcpkg' (https://github.com/Microsoft/vcpkg) registered for path 'third_party/opentelemetry-cpp/tools/vcpkg'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/third_party/benchmark'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/third_party/googletest'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/third_party/ms-gsl'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/third_party/nlohmann-json'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/third_party/opentelemetry-proto'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/third_party/opentracing-cpp'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/third_party/prometheus-cpp'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/tools/vcpkg'...
Submodule path 'third_party/opentelemetry-cpp/third_party/benchmark': checked out 'd572f4777349d43653b21d6c2fc63020ab326db2'
Submodule path 'third_party/opentelemetry-cpp/third_party/googletest': checked out 'b796f7d44681514f58a683a3a71ff17c94edb0c1'
Submodule path 'third_party/opentelemetry-cpp/third_party/ms-gsl': checked out '6f4529395c5b7c2d661812257cd6780c67e54afa'
Submodule path 'third_party/opentelemetry-cpp/third_party/nlohmann-json': checked out 'bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d'
Submodule path 'third_party/opentelemetry-cpp/third_party/opentelemetry-proto': checked out '4ca4f0335c63cda7ab31ea7ed70d6553aee14dce'
Submodule path 'third_party/opentelemetry-cpp/third_party/opentracing-cpp': checked out '06b57f48ded1fa3bdd3d4346f6ef29e40e08eaf5'
Submodule path 'third_party/opentelemetry-cpp/third_party/prometheus-cpp': checked out 'c9ffcdda9086ffd9e1283ea7a0276d831f3c8a8d'
Submodule 'civetweb' (https://github.com/civetweb/civetweb.git) registered for path 'third_party/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb'
Submodule 'googletest' (https://github.com/google/googletest.git) registered for path 'third_party/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/googletest'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/googletest'...
Submodule path 'third_party/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb': checked out 'eefb26f82b233268fc98577d265352720d477ba4'
Submodule path 'third_party/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/googletest': checked out 'e2239ee6043f73722e7aa812a459f54a28552929'
Submodule path 'third_party/opentelemetry-cpp/tools/vcpkg': checked out '8eb57355a4ffb410a2e94c07b4dca2dffbee8e50'
Submodule path 'third_party/pocketfft': checked out '9d3ab05a7fffbc71a492bc6a17be034e83e8f0fe'
Submodule path 'third_party/protobuf': checked out 'd1eca4e4b421cd2997495c4b4e65cea6be4e9b8a'
Submodule 'third_party/benchmark' (https://github.com/google/benchmark.git) registered for path 'third_party/protobuf/third_party/benchmark'
Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/protobuf/third_party/googletest'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/protobuf/third_party/benchmark'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/protobuf/third_party/googletest'...
Submodule path 'third_party/protobuf/third_party/benchmark': checked out '5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8'
Submodule path 'third_party/protobuf/third_party/googletest': checked out '5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081'
Submodule path 'third_party/psimd': checked out '072586a71b55b7f8c584153d223e95687148a900'
Submodule path 'third_party/pthreadpool': checked out '4fe0e1e183925bf8cfa6aae24237e724a96479b8'
Submodule path 'third_party/pybind11': checked out '3e9dfa2866941655c56877882565e7577de6fc7b'
Submodule path 'third_party/python-peachpy': checked out 'f45429b087dd7d5bc78bb40dc7cf06425c252d67'
Submodule path 'third_party/sleef': checked out '60e76d2bce17d278b439d9da17177c8f957a9e9b'
Submodule path 'third_party/tensorpipe': checked out '52791a2fd214b2a9dc5759d36725909c1daa7f2e'
Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/tensorpipe/third_party/googletest'
Submodule 'third_party/libnop' (https://github.com/google/libnop.git) registered for path 'third_party/tensorpipe/third_party/libnop'
Submodule 'third_party/libuv' (https://github.com/libuv/libuv.git) registered for path 'third_party/tensorpipe/third_party/libuv'
Submodule 'third_party/pybind11' (https://github.com/pybind/pybind11.git) registered for path 'third_party/tensorpipe/third_party/pybind11'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/tensorpipe/third_party/googletest'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/tensorpipe/third_party/libnop'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/tensorpipe/third_party/libuv'...
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/tensorpipe/third_party/pybind11'...
Submodule path 'third_party/tensorpipe/third_party/googletest': checked out 'aee0f9d9b5b87796ee8a0ab26b7587ec30e8858e'
Submodule path 'third_party/tensorpipe/third_party/libnop': checked out '910b55815be16109f04f4180e9adee14fb4ce281'
Submodule path 'third_party/tensorpipe/third_party/libuv': checked out '1dff88e5161cba5c59276d2070d2e304e4dcb242'
Submodule path 'third_party/tensorpipe/third_party/pybind11': checked out 'a23996fce38ff6ccfbcdc09f1e63f2c4be5ea2ef'
Submodule 'tools/clang' (https://github.com/wjakob/clang-cindex-python3) registered for path 'third_party/tensorpipe/third_party/pybind11/tools/clang'
Cloning into 'E:/PyTorch_Build/pytorch/pytorch/third_party/tensorpipe/third_party/pybind11/tools/clang'...
Submodule path 'third_party/tensorpipe/third_party/pybind11/tools/clang': checked out '6a00cbc4a9b8e68b71caf7f774b3f9c753ae84d5'
--- Submodule initialization took 555.36 sec
Traceback (most recent call last):
File "E:\PyTorch_Build\pytorch\pytorch\setup.py", line 1510, in <module>
main()
File "E:\PyTorch_Build\pytorch\pytorch\setup.py", line 1176, in main
build_deps()
File "E:\PyTorch_Build\pytorch\pytorch\setup.py", line 471, in build_deps
build_caffe2(
File "E:\PyTorch_Build\pytorch\pytorch\tools\build_pytorch_libs.py", line 82, in build_caffe2
my_env = _create_build_env()
File "E:\PyTorch_Build\pytorch\pytorch\tools\build_pytorch_libs.py", line 68, in _create_build_env
my_env = _overlay_windows_vcvars(my_env)
File "E:\PyTorch_Build\pytorch\pytorch\tools\build_pytorch_libs.py", line 37, in _overlay_windows_vcvars
vc_env: Dict[str, str] = distutils._msvccompiler._get_vc_env(vc_arch)
AttributeError: module 'distutils' has no attribute '_msvccompiler'. Did you mean: 'ccompiler'?
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> # 降级 NumPy 到兼容版本
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> pip uninstall -y numpy
Found existing installation: numpy 2.1.2
Uninstalling numpy-2.1.2:
Successfully uninstalled numpy-2.1.2
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> pip install numpy==1.26.4
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting numpy==1.26.4
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/19/77/538f202862b9183f54108557bfda67e17603fc560c384559e769321c9d92/numpy-1.26.4-cp310-cp310-win_amd64.whl (15.8 MB)
Installing collected packages: numpy
Successfully installed numpy-1.26.4
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch>
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> # 安装兼容的 PyTorch 版本
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> pip install torch==2.3.0+cu121 torchvision==0.18.0+cu121 --no-deps
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
ERROR: Could not find a version that satisfies the requirement torch==2.3.0+cu121 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.6.0, 2.7.0, 2.7.1, 2.8.0)
ERROR: No matching distribution found for torch==2.3.0+cu121
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> import torch
import: The term 'import' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> import numpy as np
import: The term 'import' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch>
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print('='*50)
无法初始化设备 PRN
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print(f'PyTorch 版本: {torch.__version__}')
fPyTorch 版本: {torch.__version__}: The term 'fPyTorch 版本: {torch.__version__}' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print(f'CUDA 可用: {torch.cuda.is_available()}')
fCUDA 可用: {torch.cuda.is_available()}: The term 'fCUDA 可用: {torch.cuda.is_available()}' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print(f'CUDA 版本: {torch.version.cuda}')
fCUDA 版本: {torch.version.cuda}: The term 'fCUDA 版本: {torch.version.cuda}' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print(f'cuDNN 版本: {torch.backends.cudnn.version()}')
fcuDNN 版本: {torch.backends.cudnn.version()}: The term 'fcuDNN 版本: {torch.backends.cudnn.version()}' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print(f'GPU 名称: {torch.cuda.get_device_name(0)}')
fGPU 名称: {torch.cuda.get_device_name(0)}: The term 'fGPU 名称: {torch.cuda.get_device_name(0)}' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print(f'计算能力: {torch.cuda.get_device_capability(0)}')
f计算能力: {torch.cuda.get_device_capability(0)}: The term 'f计算能力: {torch.cuda.get_device_capability(0)}' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch>
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> # 简单 CUDA 测试
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> x = torch.randn(100, 100, device='cuda')
ParserError:
Line |
1 | x = torch.randn(100, 100, device='cuda')
| ~
| Missing expression after ','.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> y = torch.randn(100, 100, device='cuda')
ParserError:
Line |
1 | y = torch.randn(100, 100, device='cuda')
| ~
| Missing expression after ','.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> z = x @ y
ParserError:
Line |
1 | z = x @ y
| ~
| Unrecognized token in source text.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print(f'矩阵乘法完成: {z.size()}')
f矩阵乘法完成: {z.size()}: The term 'f矩阵乘法完成: {z.size()}' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch>
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> # NumPy 互操作测试
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> a = np.random.rand(100, 100)
a: The term 'a' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> b = torch.from_numpy(a).cuda()
a: The term 'a' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> c = b.cpu().numpy()
ParserError:
Line |
1 | c = b.cpu().numpy()
| ~
| An expression was expected after '('.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print(f'NumPy 互操作测试成功: {c.shape == a.shape}')
fNumPy 互操作测试成功: {c.shape == a.shape}: The term 'fNumPy 互操作测试成功: {c.shape == a.shape}' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch>
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch> print('='*50)
无法初始化设备 PRN
(pytorch_env) PS E:\PyTorch_Build\pytorch\pytorch>