├── pytorch.png ├── pt4slogo.png ├── .gitattributes ├── Tests ├── LinuxMain.swift └── PyTorch4SwiftTests │ ├── XCTestManifests.swift │ └── PyTorch4SwiftTests.swift ├── PyTorch4Swift.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ └── AnnMargaret.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings ├── PyTorch4Swift_Info.plist ├── PyTorch4SwiftTests_Info.plist ├── xcshareddata │ └── xcschemes │ │ └── PyTorch4Swift-Package.xcscheme └── project.pbxproj ├── Sources └── PyTorch4Swift │ ├── TorchVision4Swift.swift │ ├── imports.swift │ └── PyTorch4Swift.swift ├── Package.swift └── README.md /pytorch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeamt/PyTorchSwift/HEAD/pytorch.png -------------------------------------------------------------------------------- /pt4slogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeamt/PyTorchSwift/HEAD/pt4slogo.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import PyTorch4SwiftTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += PyTorch4SwiftTests.allTests() 7 | XCTMain(tests) 8 | -------------------------------------------------------------------------------- /PyTorch4Swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /Tests/PyTorch4SwiftTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | #if !canImport(ObjectiveC) 4 | public func allTests() -> [XCTestCaseEntry] { 5 | return [ 6 | testCase(PyTorch4SwiftTests.allTests), 7 | ] 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /PyTorch4Swift.xcodeproj/project.xcworkspace/xcuserdata/AnnMargaret.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeamt/PyTorchSwift/HEAD/PyTorch4Swift.xcodeproj/project.xcworkspace/xcuserdata/AnnMargaret.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /PyTorch4Swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /PyTorch4Swift.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Tests/PyTorch4SwiftTests/PyTorch4SwiftTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import PyTorch4Swift 3 | 4 | final class PyTorch4SwiftTests: XCTestCase { 5 | func testExample() { 6 | // This is an example of a functional test case. 7 | // Use XCTAssert and related functions to verify your tests produce the correct 8 | // results. 9 | //XCTAssertEqual(PyTorch4Swift().text, "Hello, World!") 10 | } 11 | 12 | static var allTests = [ 13 | ("testExample", testExample), 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /PyTorch4Swift.xcodeproj/project.xcworkspace/xcuserdata/AnnMargaret.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | EnabledFullIndexStoreVisibility 12 | 13 | IssueFilterStyle 14 | ShowActiveSchemeOnly 15 | LiveSourceIssuesEnabled 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/PyTorch4Swift/TorchVision4Swift.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TorchVision4Swift.swift 3 | // PyTorch4Swift 4 | // 5 | // Created by AnnMargaret Tutu on 7/18/19. 6 | // 7 | 8 | import Foundation 9 | import Python 10 | 11 | class TorchVisionSwift { 12 | init() { 13 | _ = PythonImports() 14 | } 15 | let torchvision = PythonImports.torchvision 16 | let get_image_backend = PythonImports.torchvision.get_image_backend 17 | let set_image_backend = PythonImports.torchvision.set_image_backend 18 | let datasets = PythonImports.torchvision.datasets 19 | let models = PythonImports.torchvision.models 20 | let transforms = PythonImports.torchvision.transforms 21 | let utils = PythonImports.torchvision.utils 22 | } 23 | 24 | -------------------------------------------------------------------------------- /PyTorch4Swift.xcodeproj/PyTorch4Swift_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /PyTorch4Swift.xcodeproj/PyTorch4SwiftTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Sources/PyTorch4Swift/imports.swift: -------------------------------------------------------------------------------- 1 | // 2 | // imports.swift 3 | // PyTorch4Swift 4 | // 5 | // Created by AnnMargaret Tutu on 7/18/19. 6 | // 7 | 8 | import Foundation 9 | import Python 10 | import TensorFlow 11 | 12 | class PythonImports { 13 | static let sys = Python.import("sys") 14 | static let np = Python.import("numpy") 15 | static let sympy = Python.import("sympy") 16 | static let math = Python.import("math") 17 | static let random = Python.import("random") 18 | static let cPickle = Python.import("cPickle") 19 | static let torch = Python.import("torch") 20 | static let matplotlib = Python.import("matplotlib") 21 | static let plt = Python.import("matplotlib.pyplot") 22 | static let keras = Python.import("keras"); 23 | static let lambdify = Python.import("lambdify"); 24 | public static let torchvision = Python.import("torchvision") 25 | init() { 26 | PythonLibrary.useVersion(3, 6) 27 | print("Ussing Python Version: ", Python.versionInfo) 28 | print("System Path: ", PythonImports.sys.path) 29 | PythonImports.matplotlib.use("Agg") 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "PyTorch4Swift", 8 | products: [ 9 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 10 | .library( 11 | name: "PyTorch4Swift", 12 | targets: ["PyTorch4Swift"]), 13 | ], 14 | dependencies: [ 15 | // Dependencies declare other packages that this package depends on. 16 | // .package(url: /* package url */, from: "1.0.0"), 17 | ], 18 | targets: [ 19 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 20 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 21 | .target( 22 | name: "PyTorch4Swift", 23 | dependencies: []), 24 | .testTarget( 25 | name: "PyTorch4SwiftTests", 26 | dependencies: ["PyTorch4Swift"]), 27 | ] 28 | ) 29 | -------------------------------------------------------------------------------- /Sources/PyTorch4Swift/PyTorch4Swift.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import Python 3 | 4 | class PyTorchSwift { 5 | init() { 6 | _ = PythonImports() 7 | } 8 | //basic math ops 9 | let torch = PythonImports.torch 10 | //easy access to tensor types 11 | let Tensor = PythonImports.torch.Tensor 12 | let ByteTensor = PythonImports.torch.ByteTensor 13 | let FloatTensor = PythonImports.torch.FloatTensor 14 | let DoubleTensor = PythonImports.torch.DoubleTensor 15 | let HalfTensor = PythonImports.torch.HalfTensor 16 | let CharTensor = PythonImports.torch.CharTensor 17 | let ShortTensor = PythonImports.torch.ShortTensor 18 | let IntTensor = PythonImports.torch.IntTensor 19 | let LongTensor = PythonImports.torch.LongTensor 20 | let quasirandom = PythonImports.torch.quasirandom 21 | let sparse = PythonImports.torch.sparse 22 | let cuda = PythonImports.torch.cuda 23 | let FloatStorage = PythonImports.torch.FloatStorage 24 | let autograd = PythonImports.torch.autograd 25 | let optim = PythonImports.torch.optim 26 | let distributed = PythonImports.torch.distributed 27 | let distributions = PythonImports.torch.distributions 28 | let hub = PythonImports.torch.hub 29 | let jit = PythonImports.torch.jit 30 | let multiprocessing = PythonImports.torch.multiprocessing 31 | let onyx = PythonImports.torch.onyx 32 | let nn = PythonImports.torch.nn 33 | let utils = PythonImports.torch.utils 34 | } 35 | -------------------------------------------------------------------------------- /PyTorch4Swift.xcodeproj/xcshareddata/xcschemes/PyTorch4Swift-Package.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 74 | 76 | 77 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |

A Swift Wrapper for PyTorch and Torchvision.

3 | 4 | 5 | ## Getting Started 6 | **Note**: This project is not affiliated with PyTorch and is still in early development. 7 | 8 | ### Prerequisites: 9 | This library requires Xcode toolchain Swift for [Tensorflow release/Swift 5](https://swift.org/download/) 10 | 11 | ### Installing with Swift Package Manager: 12 | Add the following line to your dependencies in `Package.swift` file 13 | ``` 14 | .package(url: "https://github.com/codeamt/PyTorchSwift.git", .branch("master")), 15 | 16 | ``` 17 | 18 | ## Usage 19 | 20 | ### Importing: 21 | 22 | ``` 23 | import Foundation 24 | import Python 25 | import PyTorch4Swift 26 | 27 | let torch = PyTorchSwift() 28 | let torchvision = TorchVisionSwift() 29 | 30 | ``` 31 | **Note**: If you have trouble or get errors importing Python (even after upgrading your toolchain), try changing your build system to legacy: File > Project Settings> Build System -> Legacy 32 | ### Data Preprocessing: 33 | ``` 34 | var transforms_list:[PythonObject] = [torchvision.transforms.ToTensor(), 35 | torchvision.transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])] 36 | 37 | let transforms = torchvision.transforms.Compose(transforms_list) 38 | 39 | 40 | let trainset = torchvision.datasets.CIFAR10(root:"./data", train:true, download:true, transform:transforms) 41 | let trainloader = torch.utils.data.DataLoader(trainset, batch_size:4, shuffle:true, num_workers:2) 42 | 43 | let testset = torchvision.datasets.CIFAR10(root:"./data", train:false, download:true, transform:transforms) 44 | let testloader = torch.utils.data.DataLoader(testset, batch_size:4, shuffle:false, num_workers:2) 45 | 46 | let labels = ("plane", "car", "bird", "cat","deer", "dog", "frog", "horse", "ship", "truck") 47 | ``` 48 | 49 | ### Setting Up Transfer Learning: 50 | ``` 51 | let arch = torchvision.models.resnet18(pretrained=True) 52 | 53 | if (torch.cuda.is_available() == true){ 54 | let device = torch.device("cuda:0") 55 | arch.to(device) 56 | print(device) 57 | } else { 58 | print( "using cpu") 59 | } 60 | 61 | let criterion = torch.nn.CrossEntropyLoss() 62 | let optimizer = torch.optim.SGD(arch.parameters(), lr:0.001, momentum:0.9) 63 | 64 | var runningLoss = 0.0 65 | ``` 66 | 67 | ### Training: 68 | ``` 69 | for epoch in 0...50 { 70 | runningLoss = 0.0 71 | 72 | let trainIter:PythonObject = Python.enumerate(trainloader) 73 | 74 | for idx in trainloader.indices{ 75 | let data = trainIter.next() 76 | 77 | 78 | let inputs = data[0] 79 | let labels = data[1] 80 | 81 | // zero the parameter gradients 82 | optimizer.zero_grad() 83 | 84 | // forward + backward + optimize 85 | let outputs = arch(inputs) 86 | let loss = criterion(outputs, labels) 87 | loss.backward() 88 | optimizer.step() 89 | 90 | // print statistics 91 | runningLoss += Double(loss.item())! 92 | 93 | //print every 2000 mini-batches 94 | if (Int(idx)! % 2000 == 1999){ 95 | print("[epoch:\(epoch), \(idx + 1)] loss: \(runningLoss / 2000)") 96 | } 97 | } 98 | 99 | runningLoss = 0.0 100 | print("Finished Training") 101 | } 102 | ``` 103 | ### Testing: 104 | ``` 105 | // Test network 106 | let testiter = Python.enumerate(testloader) 107 | let data = testiter.next() 108 | let images = data[0] 109 | let labels = data[1] 110 | 111 | let outputs = arch(images) 112 | 113 | let (_, predicted) = torch.`max`(outputs) 114 | print("predicted: ",predicted) 115 | print("test images: ",images) 116 | print("test labels: ",labels) 117 | print("nn outputs: ",outputs) 118 | ``` 119 | ## Additional Notes: 120 | 121 | This library was inspired by this [repo](https://github.com/johndpope/SwiftTorch) (an executable project) and learnings from the [Fast.ai Live Course (2019) - Part 2](https://course.fast.ai/videos/?lesson=13) with the intention diversifying the DL/ML libraries available to Swift developers working on ML/DL projects and research. To report bugs please submit an issue. To contribute, please make a pull request! 122 | -------------------------------------------------------------------------------- /PyTorch4Swift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | "PyTorch4Swift::PyTorch4SwiftPackageTests::ProductTarget" /* PyTorch4SwiftPackageTests */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = OBJ_32 /* Build configuration list for PBXAggregateTarget "PyTorch4SwiftPackageTests" */; 13 | buildPhases = ( 14 | ); 15 | dependencies = ( 16 | OBJ_35 /* PBXTargetDependency */, 17 | ); 18 | name = PyTorch4SwiftPackageTests; 19 | productName = PyTorch4SwiftPackageTests; 20 | }; 21 | /* End PBXAggregateTarget section */ 22 | 23 | /* Begin PBXBuildFile section */ 24 | EDDBA57622E1083D008C1AF2 /* imports.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDDBA57522E1083D008C1AF2 /* imports.swift */; }; 25 | EDDBA57822E11709008C1AF2 /* TorchVision4Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDDBA57722E11709008C1AF2 /* TorchVision4Swift.swift */; }; 26 | OBJ_23 /* PyTorch4Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_9 /* PyTorch4Swift.swift */; }; 27 | OBJ_30 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_6 /* Package.swift */; }; 28 | OBJ_41 /* PyTorch4SwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_12 /* PyTorch4SwiftTests.swift */; }; 29 | OBJ_42 /* XCTestManifests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_13 /* XCTestManifests.swift */; }; 30 | OBJ_44 /* PyTorch4Swift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "PyTorch4Swift::PyTorch4Swift::Product" /* PyTorch4Swift.framework */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | EDDBA57322E107F6008C1AF2 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = OBJ_1 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = "PyTorch4Swift::PyTorch4Swift"; 39 | remoteInfo = PyTorch4Swift; 40 | }; 41 | EDDBA57422E107F7008C1AF2 /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = OBJ_1 /* Project object */; 44 | proxyType = 1; 45 | remoteGlobalIDString = "PyTorch4Swift::PyTorch4SwiftTests"; 46 | remoteInfo = PyTorch4SwiftTests; 47 | }; 48 | /* End PBXContainerItemProxy section */ 49 | 50 | /* Begin PBXFileReference section */ 51 | EDDBA57522E1083D008C1AF2 /* imports.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = imports.swift; sourceTree = ""; }; 52 | EDDBA57722E11709008C1AF2 /* TorchVision4Swift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TorchVision4Swift.swift; sourceTree = ""; }; 53 | OBJ_12 /* PyTorch4SwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PyTorch4SwiftTests.swift; sourceTree = ""; }; 54 | OBJ_13 /* XCTestManifests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = ""; }; 55 | OBJ_17 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 56 | OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 57 | OBJ_9 /* PyTorch4Swift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PyTorch4Swift.swift; sourceTree = ""; }; 58 | "PyTorch4Swift::PyTorch4Swift::Product" /* PyTorch4Swift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = PyTorch4Swift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | "PyTorch4Swift::PyTorch4SwiftTests::Product" /* PyTorch4SwiftTests.xctest */ = {isa = PBXFileReference; lastKnownFileType = file; path = PyTorch4SwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | OBJ_24 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 0; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | OBJ_43 /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 0; 73 | files = ( 74 | OBJ_44 /* PyTorch4Swift.framework in Frameworks */, 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | OBJ_10 /* Tests */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | OBJ_11 /* PyTorch4SwiftTests */, 85 | ); 86 | name = Tests; 87 | sourceTree = SOURCE_ROOT; 88 | }; 89 | OBJ_11 /* PyTorch4SwiftTests */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | OBJ_12 /* PyTorch4SwiftTests.swift */, 93 | OBJ_13 /* XCTestManifests.swift */, 94 | ); 95 | name = PyTorch4SwiftTests; 96 | path = Tests/PyTorch4SwiftTests; 97 | sourceTree = SOURCE_ROOT; 98 | }; 99 | OBJ_14 /* Products */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | "PyTorch4Swift::PyTorch4Swift::Product" /* PyTorch4Swift.framework */, 103 | "PyTorch4Swift::PyTorch4SwiftTests::Product" /* PyTorch4SwiftTests.xctest */, 104 | ); 105 | name = Products; 106 | sourceTree = BUILT_PRODUCTS_DIR; 107 | }; 108 | OBJ_5 /* */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | OBJ_6 /* Package.swift */, 112 | OBJ_7 /* Sources */, 113 | OBJ_10 /* Tests */, 114 | OBJ_14 /* Products */, 115 | OBJ_17 /* README.md */, 116 | ); 117 | name = ""; 118 | sourceTree = ""; 119 | }; 120 | OBJ_7 /* Sources */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | OBJ_8 /* PyTorch4Swift */, 124 | ); 125 | name = Sources; 126 | sourceTree = SOURCE_ROOT; 127 | }; 128 | OBJ_8 /* PyTorch4Swift */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | OBJ_9 /* PyTorch4Swift.swift */, 132 | EDDBA57522E1083D008C1AF2 /* imports.swift */, 133 | EDDBA57722E11709008C1AF2 /* TorchVision4Swift.swift */, 134 | ); 135 | name = PyTorch4Swift; 136 | path = Sources/PyTorch4Swift; 137 | sourceTree = SOURCE_ROOT; 138 | }; 139 | /* End PBXGroup section */ 140 | 141 | /* Begin PBXNativeTarget section */ 142 | "PyTorch4Swift::PyTorch4Swift" /* PyTorch4Swift */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = OBJ_19 /* Build configuration list for PBXNativeTarget "PyTorch4Swift" */; 145 | buildPhases = ( 146 | OBJ_22 /* Sources */, 147 | OBJ_24 /* Frameworks */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | ); 153 | name = PyTorch4Swift; 154 | productName = PyTorch4Swift; 155 | productReference = "PyTorch4Swift::PyTorch4Swift::Product" /* PyTorch4Swift.framework */; 156 | productType = "com.apple.product-type.framework"; 157 | }; 158 | "PyTorch4Swift::PyTorch4SwiftTests" /* PyTorch4SwiftTests */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = OBJ_37 /* Build configuration list for PBXNativeTarget "PyTorch4SwiftTests" */; 161 | buildPhases = ( 162 | OBJ_40 /* Sources */, 163 | OBJ_43 /* Frameworks */, 164 | ); 165 | buildRules = ( 166 | ); 167 | dependencies = ( 168 | OBJ_45 /* PBXTargetDependency */, 169 | ); 170 | name = PyTorch4SwiftTests; 171 | productName = PyTorch4SwiftTests; 172 | productReference = "PyTorch4Swift::PyTorch4SwiftTests::Product" /* PyTorch4SwiftTests.xctest */; 173 | productType = "com.apple.product-type.bundle.unit-test"; 174 | }; 175 | "PyTorch4Swift::SwiftPMPackageDescription" /* PyTorch4SwiftPackageDescription */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = OBJ_26 /* Build configuration list for PBXNativeTarget "PyTorch4SwiftPackageDescription" */; 178 | buildPhases = ( 179 | OBJ_29 /* Sources */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | ); 185 | name = PyTorch4SwiftPackageDescription; 186 | productName = PyTorch4SwiftPackageDescription; 187 | productType = "com.apple.product-type.framework"; 188 | }; 189 | /* End PBXNativeTarget section */ 190 | 191 | /* Begin PBXProject section */ 192 | OBJ_1 /* Project object */ = { 193 | isa = PBXProject; 194 | attributes = { 195 | LastSwiftMigration = 9999; 196 | LastUpgradeCheck = 9999; 197 | }; 198 | buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "PyTorch4Swift" */; 199 | compatibilityVersion = "Xcode 3.2"; 200 | developmentRegion = English; 201 | hasScannedForEncodings = 0; 202 | knownRegions = ( 203 | English, 204 | en, 205 | ); 206 | mainGroup = OBJ_5 /* */; 207 | productRefGroup = OBJ_14 /* Products */; 208 | projectDirPath = ""; 209 | projectRoot = ""; 210 | targets = ( 211 | "PyTorch4Swift::PyTorch4Swift" /* PyTorch4Swift */, 212 | "PyTorch4Swift::SwiftPMPackageDescription" /* PyTorch4SwiftPackageDescription */, 213 | "PyTorch4Swift::PyTorch4SwiftPackageTests::ProductTarget" /* PyTorch4SwiftPackageTests */, 214 | "PyTorch4Swift::PyTorch4SwiftTests" /* PyTorch4SwiftTests */, 215 | ); 216 | }; 217 | /* End PBXProject section */ 218 | 219 | /* Begin PBXSourcesBuildPhase section */ 220 | OBJ_22 /* Sources */ = { 221 | isa = PBXSourcesBuildPhase; 222 | buildActionMask = 0; 223 | files = ( 224 | EDDBA57622E1083D008C1AF2 /* imports.swift in Sources */, 225 | EDDBA57822E11709008C1AF2 /* TorchVision4Swift.swift in Sources */, 226 | OBJ_23 /* PyTorch4Swift.swift in Sources */, 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | }; 230 | OBJ_29 /* Sources */ = { 231 | isa = PBXSourcesBuildPhase; 232 | buildActionMask = 0; 233 | files = ( 234 | OBJ_30 /* Package.swift in Sources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | OBJ_40 /* Sources */ = { 239 | isa = PBXSourcesBuildPhase; 240 | buildActionMask = 0; 241 | files = ( 242 | OBJ_41 /* PyTorch4SwiftTests.swift in Sources */, 243 | OBJ_42 /* XCTestManifests.swift in Sources */, 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | /* End PBXSourcesBuildPhase section */ 248 | 249 | /* Begin PBXTargetDependency section */ 250 | OBJ_35 /* PBXTargetDependency */ = { 251 | isa = PBXTargetDependency; 252 | target = "PyTorch4Swift::PyTorch4SwiftTests" /* PyTorch4SwiftTests */; 253 | targetProxy = EDDBA57422E107F7008C1AF2 /* PBXContainerItemProxy */; 254 | }; 255 | OBJ_45 /* PBXTargetDependency */ = { 256 | isa = PBXTargetDependency; 257 | target = "PyTorch4Swift::PyTorch4Swift" /* PyTorch4Swift */; 258 | targetProxy = EDDBA57322E107F6008C1AF2 /* PBXContainerItemProxy */; 259 | }; 260 | /* End PBXTargetDependency section */ 261 | 262 | /* Begin XCBuildConfiguration section */ 263 | OBJ_20 /* Debug */ = { 264 | isa = XCBuildConfiguration; 265 | buildSettings = { 266 | ENABLE_TESTABILITY = YES; 267 | FRAMEWORK_SEARCH_PATHS = ( 268 | "$(inherited)", 269 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 270 | ); 271 | HEADER_SEARCH_PATHS = "$(inherited)"; 272 | INFOPLIST_FILE = PyTorch4Swift.xcodeproj/PyTorch4Swift_Info.plist; 273 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 274 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 275 | MACOSX_DEPLOYMENT_TARGET = 10.10; 276 | OTHER_CFLAGS = "$(inherited)"; 277 | OTHER_LDFLAGS = "$(inherited)"; 278 | OTHER_SWIFT_FLAGS = "$(inherited)"; 279 | PRODUCT_BUNDLE_IDENTIFIER = PyTorch4Swift; 280 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 281 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 282 | SKIP_INSTALL = YES; 283 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 284 | SWIFT_VERSION = 5.0; 285 | TARGET_NAME = PyTorch4Swift; 286 | TVOS_DEPLOYMENT_TARGET = 9.0; 287 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 288 | }; 289 | name = Debug; 290 | }; 291 | OBJ_21 /* Release */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | ENABLE_TESTABILITY = YES; 295 | FRAMEWORK_SEARCH_PATHS = ( 296 | "$(inherited)", 297 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 298 | ); 299 | HEADER_SEARCH_PATHS = "$(inherited)"; 300 | INFOPLIST_FILE = PyTorch4Swift.xcodeproj/PyTorch4Swift_Info.plist; 301 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 302 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 303 | MACOSX_DEPLOYMENT_TARGET = 10.10; 304 | OTHER_CFLAGS = "$(inherited)"; 305 | OTHER_LDFLAGS = "$(inherited)"; 306 | OTHER_SWIFT_FLAGS = "$(inherited)"; 307 | PRODUCT_BUNDLE_IDENTIFIER = PyTorch4Swift; 308 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 309 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 310 | SKIP_INSTALL = YES; 311 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 312 | SWIFT_VERSION = 5.0; 313 | TARGET_NAME = PyTorch4Swift; 314 | TVOS_DEPLOYMENT_TARGET = 9.0; 315 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 316 | }; 317 | name = Release; 318 | }; 319 | OBJ_27 /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | LD = /usr/bin/true; 323 | OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"; 324 | SWIFT_VERSION = 5.0; 325 | }; 326 | name = Debug; 327 | }; 328 | OBJ_28 /* Release */ = { 329 | isa = XCBuildConfiguration; 330 | buildSettings = { 331 | LD = /usr/bin/true; 332 | OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"; 333 | SWIFT_VERSION = 5.0; 334 | }; 335 | name = Release; 336 | }; 337 | OBJ_3 /* Debug */ = { 338 | isa = XCBuildConfiguration; 339 | buildSettings = { 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | COMBINE_HIDPI_IMAGES = YES; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = dwarf; 344 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 345 | ENABLE_NS_ASSERTIONS = YES; 346 | GCC_OPTIMIZATION_LEVEL = 0; 347 | GCC_PREPROCESSOR_DEFINITIONS = ( 348 | "$(inherited)", 349 | "SWIFT_PACKAGE=1", 350 | "DEBUG=1", 351 | ); 352 | MACOSX_DEPLOYMENT_TARGET = 10.10; 353 | ONLY_ACTIVE_ARCH = YES; 354 | OTHER_SWIFT_FLAGS = "-DXcode"; 355 | PRODUCT_NAME = "$(TARGET_NAME)"; 356 | SDKROOT = macosx; 357 | SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; 358 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE DEBUG"; 359 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 360 | USE_HEADERMAP = NO; 361 | }; 362 | name = Debug; 363 | }; 364 | OBJ_33 /* Debug */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | }; 368 | name = Debug; 369 | }; 370 | OBJ_34 /* Release */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | }; 374 | name = Release; 375 | }; 376 | OBJ_38 /* Debug */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | CLANG_ENABLE_MODULES = YES; 380 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; 381 | FRAMEWORK_SEARCH_PATHS = ( 382 | "$(inherited)", 383 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 384 | ); 385 | HEADER_SEARCH_PATHS = "$(inherited)"; 386 | INFOPLIST_FILE = PyTorch4Swift.xcodeproj/PyTorch4SwiftTests_Info.plist; 387 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 388 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks"; 389 | MACOSX_DEPLOYMENT_TARGET = 10.10; 390 | OTHER_CFLAGS = "$(inherited)"; 391 | OTHER_LDFLAGS = "$(inherited)"; 392 | OTHER_SWIFT_FLAGS = "$(inherited)"; 393 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 394 | SWIFT_VERSION = 5.0; 395 | TARGET_NAME = PyTorch4SwiftTests; 396 | TVOS_DEPLOYMENT_TARGET = 9.0; 397 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 398 | }; 399 | name = Debug; 400 | }; 401 | OBJ_39 /* Release */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | CLANG_ENABLE_MODULES = YES; 405 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; 406 | FRAMEWORK_SEARCH_PATHS = ( 407 | "$(inherited)", 408 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 409 | ); 410 | HEADER_SEARCH_PATHS = "$(inherited)"; 411 | INFOPLIST_FILE = PyTorch4Swift.xcodeproj/PyTorch4SwiftTests_Info.plist; 412 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 413 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks"; 414 | MACOSX_DEPLOYMENT_TARGET = 10.10; 415 | OTHER_CFLAGS = "$(inherited)"; 416 | OTHER_LDFLAGS = "$(inherited)"; 417 | OTHER_SWIFT_FLAGS = "$(inherited)"; 418 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 419 | SWIFT_VERSION = 5.0; 420 | TARGET_NAME = PyTorch4SwiftTests; 421 | TVOS_DEPLOYMENT_TARGET = 9.0; 422 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 423 | }; 424 | name = Release; 425 | }; 426 | OBJ_4 /* Release */ = { 427 | isa = XCBuildConfiguration; 428 | buildSettings = { 429 | CLANG_ENABLE_OBJC_ARC = YES; 430 | COMBINE_HIDPI_IMAGES = YES; 431 | COPY_PHASE_STRIP = YES; 432 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 433 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 434 | GCC_OPTIMIZATION_LEVEL = s; 435 | GCC_PREPROCESSOR_DEFINITIONS = ( 436 | "$(inherited)", 437 | "SWIFT_PACKAGE=1", 438 | ); 439 | MACOSX_DEPLOYMENT_TARGET = 10.10; 440 | OTHER_SWIFT_FLAGS = "-DXcode"; 441 | PRODUCT_NAME = "$(TARGET_NAME)"; 442 | SDKROOT = macosx; 443 | SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; 444 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE"; 445 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 446 | USE_HEADERMAP = NO; 447 | }; 448 | name = Release; 449 | }; 450 | /* End XCBuildConfiguration section */ 451 | 452 | /* Begin XCConfigurationList section */ 453 | OBJ_19 /* Build configuration list for PBXNativeTarget "PyTorch4Swift" */ = { 454 | isa = XCConfigurationList; 455 | buildConfigurations = ( 456 | OBJ_20 /* Debug */, 457 | OBJ_21 /* Release */, 458 | ); 459 | defaultConfigurationIsVisible = 0; 460 | defaultConfigurationName = Release; 461 | }; 462 | OBJ_2 /* Build configuration list for PBXProject "PyTorch4Swift" */ = { 463 | isa = XCConfigurationList; 464 | buildConfigurations = ( 465 | OBJ_3 /* Debug */, 466 | OBJ_4 /* Release */, 467 | ); 468 | defaultConfigurationIsVisible = 0; 469 | defaultConfigurationName = Release; 470 | }; 471 | OBJ_26 /* Build configuration list for PBXNativeTarget "PyTorch4SwiftPackageDescription" */ = { 472 | isa = XCConfigurationList; 473 | buildConfigurations = ( 474 | OBJ_27 /* Debug */, 475 | OBJ_28 /* Release */, 476 | ); 477 | defaultConfigurationIsVisible = 0; 478 | defaultConfigurationName = Release; 479 | }; 480 | OBJ_32 /* Build configuration list for PBXAggregateTarget "PyTorch4SwiftPackageTests" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | OBJ_33 /* Debug */, 484 | OBJ_34 /* Release */, 485 | ); 486 | defaultConfigurationIsVisible = 0; 487 | defaultConfigurationName = Release; 488 | }; 489 | OBJ_37 /* Build configuration list for PBXNativeTarget "PyTorch4SwiftTests" */ = { 490 | isa = XCConfigurationList; 491 | buildConfigurations = ( 492 | OBJ_38 /* Debug */, 493 | OBJ_39 /* Release */, 494 | ); 495 | defaultConfigurationIsVisible = 0; 496 | defaultConfigurationName = Release; 497 | }; 498 | /* End XCConfigurationList section */ 499 | }; 500 | rootObject = OBJ_1 /* Project object */; 501 | } 502 | --------------------------------------------------------------------------------