xref: /aosp_15_r20/external/pytorch/ios/README.md (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1*da0073e9SAndroid Build Coastguard Worker
2*da0073e9SAndroid Build Coastguard Worker## PyTorch for iOS
3*da0073e9SAndroid Build Coastguard Worker
4*da0073e9SAndroid Build Coastguard Worker### Cocoapods Developers
5*da0073e9SAndroid Build Coastguard Worker
6*da0073e9SAndroid Build Coastguard WorkerPyTorch is now available via Cocoapods, to integrate it to your project, simply add the following line to your `Podfile` and run `pod install`
7*da0073e9SAndroid Build Coastguard Worker
8*da0073e9SAndroid Build Coastguard Worker```ruby
9*da0073e9SAndroid Build Coastguard Workerpod 'LibTorch-Lite'
10*da0073e9SAndroid Build Coastguard Worker```
11*da0073e9SAndroid Build Coastguard Worker
12*da0073e9SAndroid Build Coastguard Worker### Import the library
13*da0073e9SAndroid Build Coastguard Worker
14*da0073e9SAndroid Build Coastguard WorkerFor Objective-C developers, simply import the umbrella header
15*da0073e9SAndroid Build Coastguard Worker
16*da0073e9SAndroid Build Coastguard Worker```
17*da0073e9SAndroid Build Coastguard Worker#import <LibTorch-Lite.h>
18*da0073e9SAndroid Build Coastguard Worker```
19*da0073e9SAndroid Build Coastguard Worker
20*da0073e9SAndroid Build Coastguard WorkerFor Swift developers, you need to create an Objective-C class as a bridge to call the C++ APIs. We highly recommend you to follow the [Image Classification](https://github.com/pytorch/ios-demo-app/tree/master/PyTorchDemo) demo where you can find out how C++, Objective-C and Swift work together.
21*da0073e9SAndroid Build Coastguard Worker
22*da0073e9SAndroid Build Coastguard Worker### Disable Bitcode
23*da0073e9SAndroid Build Coastguard Worker
24*da0073e9SAndroid Build Coastguard WorkerSince PyTorch is not yet built with bitcode support, you need to disable bitcode for your target by selecting the **Build Settings**, searching for **Enable Bitcode** and set the value to **No**.
25*da0073e9SAndroid Build Coastguard Worker
26*da0073e9SAndroid Build Coastguard Worker## LICENSE
27*da0073e9SAndroid Build Coastguard Worker
28*da0073e9SAndroid Build Coastguard WorkerPyTorch is BSD-style licensed, as found in the LICENSE file.
29