pytorch 基础- variable 以及function定义等

https://zhuanlan.zhihu.com/p/27783097
可是为什么我觉得你在胡说八道 你给我的验证代码 根本不好使 你怎么确定你说的那些 已经做完的内容 是真的做完了?你验证过吗?“# 可随时启动的编译监控 Get-Counter '\Process(*)\% Processor Time' -Continuous ”“PowerShell 閰嶇疆鏂囦欢宸插垵濮嬪寲 Import-Module : 加载扩展类型数据文件时出现以下错误: TypeData“System.Security.AccessControl.ObjectSecurity”错误: 成员 AuditToString 已存在。 TypeData“System.Security.AccessControl.ObjectSecurity”错误: 成员 AccessToString 已存在。 TypeData“System.Security.AccessControl.ObjectSecurity”错误: 成员 Sddl 已存在。 TypeData“System.Security.AccessControl.ObjectSecurity”错误: 成员 Access 已存在。 TypeData“System.Security.AccessControl.ObjectSecurity”错误: 成员 Group 已存在。 TypeData“System.Security.AccessControl.ObjectSecurity”错误: 成员 Owner 已存在。 TypeData“System.Security.AccessControl.ObjectSecurity”错误: 成员 Path 已存在。 所在位置 C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:5 字符: 1 Import-Module Microsoft.PowerShell.Security -ErrorAction SilentlyCont … + CategoryInfo : InvalidOperation: (:) [Import-Module],RuntimeException + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand 已启动脚本,输出文件为 build_20250902_230603.log ====== PyTorch 澧炲己鏋勫缓 V10 ====== 鉁?鑷姩妫€娴嬪埌CUDA璺緞: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1 鉂?鏋勫缓杩囩▼涓彂鐢熶弗閲嶉敊璇? 鏃犳硶鑷姩妫€娴婥UDA璺緞 閿欒鎶ュ憡宸蹭繚瀛樺埌 build_error.log 鎸変换鎰忛敭閫€鍑?.. ” ”PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> cd E:\PyTorch_Build\pytorch PS E:\PyTorch_Build\pytorch> python -m venv rtx5070_env PS E:\PyTorch_Build\pytorch> .\rtx5070_env\Scripts\activate (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 1. 创建完整的脚本文件 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Content -Path “build_optimized_v10.ps1” -Value $scriptContent InvalidOperation: The variable ‘$scriptContent’ cannot be retrieved because it has not been set. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 2. 赋予执行权限(如果安全策略阻止) (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 3. 以管理员权限运行脚本 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Start-Process powershell -ArgumentList { Set-Location 'E:\PyTorch_Build\pytorch' .\build_optimized_v10.ps1 -Verbose } -Verb RunAs -WindowStyle Normal -Wait (rtx5070_env) PS E:\PyTorch_Build\pytorch> ^C (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 1. 创建完整的脚本文件 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Content -Path “build_optimized_v10.ps1” -Value $scriptContent InvalidOperation: The variable ‘$scriptContent’ cannot be retrieved because it has not been set. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 2. 赋予执行权限(如果安全策略阻止) (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 3. 以管理员权限运行脚本 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Start-Process powershell -ArgumentList { Set-Location ‘E:\PyTorch_Build\pytorch’ .\build_optimized_v10.ps1 -Verbose } -Verb RunAs -WindowStyle Normal -Wait (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 1. 创建完整的脚本文件 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Content -Path “build_optimized_v10.ps1” -Value $scriptContent InvalidOperation: The variable ‘$scriptContent’ cannot be retrieved because it has not been set. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 2. 赋予执行权限(如果安全策略阻止) (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 3. 以管理员权限运行脚本 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Start-Process powershell -ArgumentList { Set-Location ‘E:\PyTorch_Build\pytorch’ .\build_optimized_v10.ps1 -Verbose } -Verb RunAs -WindowStyle Normal -Wait (rtx5070_env) PS E:\PyTorch_Build\pytorch> ^C (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 1. 创建完整的脚本文件 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-Content -Path “build_optimized_v10.ps1” -Value $scriptContent InvalidOperation: The variable ‘$scriptContent’ cannot be retrieved because it has not been set. (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 2. 赋予执行权限(如果安全策略阻止) (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 3. 以管理员权限运行脚本 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Start-Process powershell -ArgumentList { Set-Location ‘E:\PyTorch_Build\pytorch’ .\build_optimized_v10.ps1 -Verbose } -Verb RunAs -WindowStyle Normal -Wait (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 完整的代码块粘贴(复制以下所有内容一次性粘贴到PowerShell) (rtx5070_env) PS E:\PyTorch_Build\pytorch> $completeScript = { param([switch]$Verbose = $false) # 这里包含完整的脚本内容... # 从param到finally的所有内容 # 注意:整个代码块必须一次性粘贴 } (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 执行代码块 (rtx5070_env) PS E:\PyTorch_Build\pytorch> & $completeScript -Verbose (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 1. 启用详细调试 (rtx5070_env) PS E:\PyTorch_Build\pytorch> $VerbosePreference = “Continue” (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 2. 逐行调试 (rtx5070_env) PS E:\PyTorch_Build\pytorch> Set-PSBreakpoint -Script .\build_optimized_v10.ps1 -Line 25 ID Script Line Command Variable Action 1 build_optimized_v10.ps1 25 (rtx5070_env) PS E:\PyTorch_Build\pytorch> (rtx5070_env) PS E:\PyTorch_Build\pytorch> # 3. 出错时暂停 (rtx5070_env) PS E:\PyTorch_Build\pytorch> trap { Write-Host "错误发生: $_" -ForegroundColor Red Write-Host "按任意键继续..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") continue } (rtx5070_env) PS E:\PyTorch_Build\pytorch>“
最新发布
09-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值