you’re not supposed to use cocoapods to recompile. Can you try

Clone pytorch and check out the master branch
Manually apply the changes in the PR (only one liner)
Follow the section https://pytorch.org/mobile/ios/#build-pytorch-ios-libraries-from-source 6 to recompile from source code and setup XCode