Files
pytorch/scripts/proto.ps1
PyTorch MergeBot ced5cf042d Revert "Cleanup old caffe2 scripts (#158475)"
This reverts commit 94d7f0c1ef9a4cb4db0eb5d6b1ffc55941cbeab1.

Reverted https://github.com/pytorch/pytorch/pull/158475 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally ([comment](https://github.com/pytorch/pytorch/pull/158475#issuecomment-3085447409))
2025-07-17 20:58:34 +00:00

19 lines
674 B
PowerShell

param(
[string]$protoc,
[string]$srcdir,
[string]$unprocessed,
[string]$processed,
[string]$out
)
$ErrorActionPreference = "Stop"
Get-Content $unprocessed | % {$_ -Replace "caffe2/proto/caffe2.proto", "caffe2.proto"} | Set-Content $processed
Add-Content -Path $processed -Value "option optimize_for = LITE_RUNTIME;`n" -NoNewline
$dir = (Get-Item $processed).DirectoryName
copy $srcdir/caffe2/proto/caffe2.proto $srcdir/caffe2.proto
Add-Content -Path $srcdir/caffe2.proto -Value "option optimize_for = LITE_RUNTIME;`n" -NoNewline
$processed = (Get-Item $processed).Name
$cmd = "$protoc -I${dir} --cpp_out=$out $processed"
Invoke-Expression $cmd