Skip to content

[iOS] [HelloWorld] In Xcode Release mode, any module outputs always same #66993

Closed
pytorch/ios-demo-app
#76
@darkThanBlack

Description

@darkThanBlack

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:

  1. Download PyTorch HelloWorld proj from https://github.com/pytorch/ios-demo-app/tree/master/HelloWorld.
  2. Insert different image and model to proj.
  3. Create different pixelBuffer from inserted image, print result for module.predict(image: UnsafeMutableRawPointer(&pixelBuffer)) func, we can find outputs value is different.
  4. In Xcode IDE, select Edit Scheme... -> Run -> Info -> Build Configuration from Debug to Release.
  5. just print return value for module.predict(image: UnsafeMutableRawPointer(&pixelBuffer)) again, we can find all outputs value is same.
  6. 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

  1. You can find my sample code in ViewController.m, Line 24 to Line 67...
  2. I tried change .pt and predict 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.
  3. I also tried change all proj Build Settings config releated to Debug/Release but can't fix it.
  4. 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...
  5. Here is some hint image for help...

hint02

hint03

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    oncall: mobileRelated to mobile support, including iOS and Android

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions