Closed
Description
Releated
I really don't know which part (PyTorch source or Xcode proj setting) caused this problem, sorry for that but I also reported this #72
🐛 Bug
In PyTorch iOS HelloWorld proj, if you just change Build Configuration
to Release
,the module output always same value.
To Reproduce
Steps to reproduce the behavior:
- Download PyTorch HelloWorld proj from https://github.com/pytorch/ios-demo-app/tree/master/HelloWorld.
- Insert different image and model to proj.
- Create different pixelBuffer from inserted image, print result for
module.predict(image: UnsafeMutableRawPointer(&pixelBuffer))
func, we can find outputs value is different. - In Xcode IDE, select
Edit Scheme... -> Run -> Info -> Build Configuration
fromDebug
toRelease
. - just print return value for
module.predict(image: UnsafeMutableRawPointer(&pixelBuffer))
again, we can find all outputs value is same. - I also uploaded my test proj, just simply changed sth. from HelloWord, you can find it here: https://github.com/darkThanBlack/MOONPyTorchIssue, you may need change
Signing Certificate
or other configs to run it.
Other Info
- You can find my sample code in
ViewController.m, Line 24 to Line 67
... - I tried change
.pt
andpredict
implement(I have another private proj to do some face recognize and it works well in Debug mode, I can't upload it because relate some user info), no matter what things I input, outputs seemd a static value. - I also tried change all proj
Build Settings
config releated to Debug/Release but can't fix it. - I also tried build PyTorch Libraries from source but still can't fix it , I tried read PyTorch source code but not sure how Xcode proj's Debug/Release affect
.a
libraries... - Here is some hint image for help...
Environment
- Setup PyTorch with
pod 'LibTorch-Lite', '~> 1.9.0'
or build from source. - OS : Apple M1, iPhone 12(iOS 14.8);Other Mac/iOS OS is reproducible too.