Skip to content

Commit 2570006

Browse files
committed
fix windows pytorch 1.7.0
1 parent 45ae8aa commit 2570006

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

script/torch.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
#!/bin/bash
22

3-
# Fix "member may not be initialized" error on Windows: https://github.com/pytorch/pytorch/issues/27958
4-
if [ "${TRAVIS_OS_NAME}" = "windows" ] && [ "${TORCH_VERSION}" = "1.5.0" ]; then
5-
echo "Fix nvcc for PyTorch 1.5.0"
6-
sed -i.bak -e 's/constexpr/const/g' /c/tools/miniconda3/envs/test/lib/site-packages/torch/include/torch/csrc/jit/api/module.h
7-
sed -i.bak -e 's/constexpr/const/g' /c/tools/miniconda3/envs/test/lib/site-packages/torch/include/torch/csrc/jit/runtime/argument_spec.h
8-
sed -i.bak -e 's/return \*(this->value)/return \*((type\*)this->value)/g' /c/tools/miniconda3/envs/test/lib/site-packages/torch/include/pybind11/cast.h
9-
fi
10-
113
# https://github.com/pytorch/pytorch/commit/d2e16dd888a9b5fd55bd475d4fcffb70f388d4f0
12-
if [ "${TRAVIS_OS_NAME}" = "windows" ] && [ "${TORCH_VERSION}" = "1.6.0" ]; then
13-
echo "Fix nvcc for PyTorch 1.6.0"
4+
if [ "${TRAVIS_OS_NAME}" = "windows" ]; then
5+
echo "Fix nvcc for PyTorch"
146
sed -i.bak -e 's/CONSTEXPR_EXCEPT_WIN_CUDA/const/g' /c/tools/miniconda3/envs/test/lib/site-packages/torch/include/torch/csrc/jit/api/module.h
157
sed -i.bak -e 's/return \*(this->value)/return \*((type\*)this->value)/g' /c/tools/miniconda3/envs/test/lib/site-packages/torch/include/pybind11/cast.h
168
fi
9+
10+
if [ "${TRAVIS_OS_NAME}" = "windows" ] && [ "${TORCH_VERSION}" = "1.7.0" ]; then
11+
echo "Fix nvcc for PyTorch 1.7.0"
12+
sed -i.bak '/static constexpr Symbol Kind/d' /c/tools/miniconda3/envs/test/lib/site-packages/torch/include/torch/csrc/jit/ir/ir.h
13+
fi

0 commit comments

Comments
 (0)