diff --git a/.gitignore b/.gitignore index 532601bfe9222eae0d6be7378322ab1b9c2eb110..0919259171969abe844a2de63e2316f7b94dcabe 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,22 @@ build # clion building directories cmake-build-debug cmake-build-release + +# Pods + +Podfile.lock + +SwiftProtobuf.framework + +metal/Pods/ + +paddle-mobile.xcworkspace + + + + + + + + + diff --git a/metal/Podfile b/metal/Podfile new file mode 100644 index 0000000000000000000000000000000000000000..87b3324209bdef84f1f56883394e4f992708d8d8 --- /dev/null +++ b/metal/Podfile @@ -0,0 +1,14 @@ +platform :ios, ‘9.0’ +use_frameworks! + +workspace 'paddle-mobile.xcworkspace' + +target 'paddle-mobile-demo' do + project 'paddle-mobile-demo/paddle-mobile-demo.xcodeproj' + pod 'SwiftProtobuf', '~> 1.0' +end + +target 'paddle-mobile' do + project 'paddle-mobile/paddle-mobile.xcodeproj' + pod 'SwiftProtobuf', '~> 1.0' +end diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj new file mode 100644 index 0000000000000000000000000000000000000000..431e5ee2749eb8f8f65eee06c72164f0b12c7a75 --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj @@ -0,0 +1,410 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 30D0ED21F392CFA3885B1002 /* Pods_paddle_mobile_demo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18896810981724F8A0FED62A /* Pods_paddle_mobile_demo.framework */; }; + FC039B8220E11C550081E9F8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039B8120E11C550081E9F8 /* AppDelegate.swift */; }; + FC039B8420E11C550081E9F8 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039B8320E11C550081E9F8 /* ViewController.swift */; }; + FC039B8720E11C550081E9F8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FC039B8520E11C550081E9F8 /* Main.storyboard */; }; + FC039B8920E11C560081E9F8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FC039B8820E11C560081E9F8 /* Assets.xcassets */; }; + FC039B8C20E11C560081E9F8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FC039B8A20E11C560081E9F8 /* LaunchScreen.storyboard */; }; + FC039BC220E11CD00081E9F8 /* test.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BC120E11CD00081E9F8 /* test.pb.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 081C9CF10DB06C58B8B6B039 /* Pods-paddle-mobile-demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-paddle-mobile-demo.release.xcconfig"; path = "../Pods/Target Support Files/Pods-paddle-mobile-demo/Pods-paddle-mobile-demo.release.xcconfig"; sourceTree = ""; }; + 18896810981724F8A0FED62A /* Pods_paddle_mobile_demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_paddle_mobile_demo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 878829884E1A14D7044721D5 /* Pods-paddle-mobile-demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-paddle-mobile-demo.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-paddle-mobile-demo/Pods-paddle-mobile-demo.debug.xcconfig"; sourceTree = ""; }; + FC039B7E20E11C550081E9F8 /* paddle-mobile-demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "paddle-mobile-demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + FC039B8120E11C550081E9F8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + FC039B8320E11C550081E9F8 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + FC039B8620E11C550081E9F8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + FC039B8820E11C560081E9F8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + FC039B8B20E11C560081E9F8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + FC039B8D20E11C560081E9F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FC039BC120E11CD00081E9F8 /* test.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = test.pb.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FC039B7B20E11C550081E9F8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 30D0ED21F392CFA3885B1002 /* Pods_paddle_mobile_demo.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 5722B50FEC38F55CA9B6A57B /* Pods */ = { + isa = PBXGroup; + children = ( + 878829884E1A14D7044721D5 /* Pods-paddle-mobile-demo.debug.xcconfig */, + 081C9CF10DB06C58B8B6B039 /* Pods-paddle-mobile-demo.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 7B7DED984E9EE7BFB45E24E8 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 18896810981724F8A0FED62A /* Pods_paddle_mobile_demo.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + FC039B7520E11C550081E9F8 = { + isa = PBXGroup; + children = ( + FC039B8020E11C550081E9F8 /* paddle-mobile-demo */, + FC039B7F20E11C550081E9F8 /* Products */, + 5722B50FEC38F55CA9B6A57B /* Pods */, + 7B7DED984E9EE7BFB45E24E8 /* Frameworks */, + ); + sourceTree = ""; + }; + FC039B7F20E11C550081E9F8 /* Products */ = { + isa = PBXGroup; + children = ( + FC039B7E20E11C550081E9F8 /* paddle-mobile-demo.app */, + ); + name = Products; + sourceTree = ""; + }; + FC039B8020E11C550081E9F8 /* paddle-mobile-demo */ = { + isa = PBXGroup; + children = ( + FC039BC120E11CD00081E9F8 /* test.pb.swift */, + FC039B8120E11C550081E9F8 /* AppDelegate.swift */, + FC039B8320E11C550081E9F8 /* ViewController.swift */, + FC039B8520E11C550081E9F8 /* Main.storyboard */, + FC039B8820E11C560081E9F8 /* Assets.xcassets */, + FC039B8A20E11C560081E9F8 /* LaunchScreen.storyboard */, + FC039B8D20E11C560081E9F8 /* Info.plist */, + ); + path = "paddle-mobile-demo"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + FC039B7D20E11C550081E9F8 /* paddle-mobile-demo */ = { + isa = PBXNativeTarget; + buildConfigurationList = FC039B9020E11C560081E9F8 /* Build configuration list for PBXNativeTarget "paddle-mobile-demo" */; + buildPhases = ( + 9E041A9C487A2E44C709327E /* [CP] Check Pods Manifest.lock */, + FC039B7A20E11C550081E9F8 /* Sources */, + FC039B7B20E11C550081E9F8 /* Frameworks */, + FC039B7C20E11C550081E9F8 /* Resources */, + 84ED590C0E51ABA9C34F51B5 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "paddle-mobile-demo"; + productName = "paddle-mobile-demo"; + productReference = FC039B7E20E11C550081E9F8 /* paddle-mobile-demo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FC039B7620E11C550081E9F8 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0930; + LastUpgradeCheck = 0930; + ORGANIZATIONNAME = orange; + TargetAttributes = { + FC039B7D20E11C550081E9F8 = { + CreatedOnToolsVersion = 9.3.1; + }; + }; + }; + buildConfigurationList = FC039B7920E11C550081E9F8 /* Build configuration list for PBXProject "paddle-mobile-demo" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = FC039B7520E11C550081E9F8; + productRefGroup = FC039B7F20E11C550081E9F8 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FC039B7D20E11C550081E9F8 /* paddle-mobile-demo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + FC039B7C20E11C550081E9F8 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FC039B8C20E11C560081E9F8 /* LaunchScreen.storyboard in Resources */, + FC039B8920E11C560081E9F8 /* Assets.xcassets in Resources */, + FC039B8720E11C550081E9F8 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 84ED590C0E51ABA9C34F51B5 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/../Pods/Target Support Files/Pods-paddle-mobile-demo/Pods-paddle-mobile-demo-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-paddle-mobile-demo/Pods-paddle-mobile-demo-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9E041A9C487A2E44C709327E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-paddle-mobile-demo-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + FC039B7A20E11C550081E9F8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FC039B8420E11C550081E9F8 /* ViewController.swift in Sources */, + FC039BC220E11CD00081E9F8 /* test.pb.swift in Sources */, + FC039B8220E11C550081E9F8 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + FC039B8520E11C550081E9F8 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + FC039B8620E11C550081E9F8 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + FC039B8A20E11C560081E9F8 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + FC039B8B20E11C560081E9F8 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + FC039B8E20E11C560081E9F8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + FC039B8F20E11C560081E9F8 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + FC039B9120E11C560081E9F8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 878829884E1A14D7044721D5 /* Pods-paddle-mobile-demo.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = Z5M2UUN5YV; + INFOPLIST_FILE = "paddle-mobile-demo/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "orange.paddle-mobile-demo"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + FC039B9220E11C560081E9F8 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 081C9CF10DB06C58B8B6B039 /* Pods-paddle-mobile-demo.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = Z5M2UUN5YV; + INFOPLIST_FILE = "paddle-mobile-demo/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "orange.paddle-mobile-demo"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FC039B7920E11C550081E9F8 /* Build configuration list for PBXProject "paddle-mobile-demo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FC039B8E20E11C560081E9F8 /* Debug */, + FC039B8F20E11C560081E9F8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FC039B9020E11C560081E9F8 /* Build configuration list for PBXNativeTarget "paddle-mobile-demo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FC039B9120E11C560081E9F8 /* Debug */, + FC039B9220E11C560081E9F8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FC039B7620E11C550081E9F8 /* Project object */; +} diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000000000000000000000000000000000..d363ac3d832069ff15c89241985b5be4f48a4e1a --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000000000000000000000000000000000..18d981003d68d0546c4804ac2ff47dd97c6e7921 --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..c13bba168aef55d0004299258e02496fc2486236 Binary files /dev/null and b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000000000000000000000000000000000000..125fd5ec745f635929df2d4e29f8147ab9a6b83a --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + paddle-mobile-demo.xcscheme + + orderHint + 4 + + + + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/AppDelegate.swift b/metal/paddle-mobile-demo/paddle-mobile-demo/AppDelegate.swift new file mode 100644 index 0000000000000000000000000000000000000000..152f094ff67de4646ddb532950965902b6c31f05 --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// paddle-mobile-demo +// +// Created by liuRuiLong on 2018/6/25. +// Copyright © 2018年 orange. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/Assets.xcassets/AppIcon.appiconset/Contents.json b/metal/paddle-mobile-demo/paddle-mobile-demo/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..d8db8d65fd79fd541b2b7eba75c7378af3448f9c --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/Assets.xcassets/Contents.json b/metal/paddle-mobile-demo/paddle-mobile-demo/Assets.xcassets/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..da4a164c918651cdd1e11dca5cc62c333f097601 --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/LaunchScreen.storyboard b/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000000000000000000000000000000000000..f83f6fd5810b9c852cf98563d82d5ed1e84ff893 --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard b/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard new file mode 100644 index 0000000000000000000000000000000000000000..03c13c2286150ad7416086bec99d2c46ccca6efc --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/Info.plist b/metal/paddle-mobile-demo/paddle-mobile-demo/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..16be3b681122de83e380d47b840b7d0486f71f86 --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift b/metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..9f366164fe9f45e6f62fc3e9aa848af4e43c8bf3 --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift @@ -0,0 +1,27 @@ +// +// ViewController.swift +// paddle-mobile-demo +// +// Created by liuRuiLong on 2018/6/25. +// Copyright © 2018年 orange. All rights reserved. +// + + +import UIKit +import paddle_mobile + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + +} + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/test.pb.swift b/metal/paddle-mobile-demo/paddle-mobile-demo/test.pb.swift new file mode 100644 index 0000000000000000000000000000000000000000..e02fb155acbab97bab2296a6505d3110f8a371f4 --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/test.pb.swift @@ -0,0 +1,79 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: test.proto +// +// For information on using the generated types, please see the documenation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that your are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct BookInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: Int64 = 0 + + var title: String = String() + + var author: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +extension BookInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = "BookInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "title"), + 3: .same(proto: "author"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.id) + case 2: try decoder.decodeSingularStringField(value: &self.title) + case 3: try decoder.decodeSingularStringField(value: &self.author) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.id != 0 { + try visitor.visitSingularInt64Field(value: self.id, fieldNumber: 1) + } + if !self.title.isEmpty { + try visitor.visitSingularStringField(value: self.title, fieldNumber: 2) + } + if !self.author.isEmpty { + try visitor.visitSingularStringField(value: self.author, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: BookInfo) -> Bool { + if self.id != other.id {return false} + if self.title != other.title {return false} + if self.author != other.author {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} diff --git a/metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj b/metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj new file mode 100644 index 0000000000000000000000000000000000000000..671c5a1d4de70c78a83a63165c9e5875b617be78 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj @@ -0,0 +1,497 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + D3831F70E7E0B565B9AC22DA /* Pods_paddle_mobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD2E06330A1E7129C918DB46 /* Pods_paddle_mobile.framework */; }; + FC039B6F20E11C3C0081E9F8 /* paddle_mobile.h in Headers */ = {isa = PBXBuildFile; fileRef = FC039B6D20E11C3C0081E9F8 /* paddle_mobile.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FC039B9720E11C9A0081E9F8 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039B9420E11C9A0081E9F8 /* Extensions.swift */; }; + FC039B9820E11C9A0081E9F8 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039B9520E11C9A0081E9F8 /* Errors.swift */; }; + FC039B9920E11C9A0081E9F8 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039B9620E11C9A0081E9F8 /* Types.swift */; }; + FC039B9B20E11CA00081E9F8 /* Executor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039B9A20E11CA00081E9F8 /* Executor.swift */; }; + FC039B9F20E11CB20081E9F8 /* Tensor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039B9D20E11CB20081E9F8 /* Tensor.swift */; }; + FC039BA020E11CB20081E9F8 /* Dim.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039B9E20E11CB20081E9F8 /* Dim.swift */; }; + FC039BA220E11CB70081E9F8 /* Loader.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BA120E11CB70081E9F8 /* Loader.swift */; }; + FC039BA920E11CBC0081E9F8 /* ConvOp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BA420E11CBC0081E9F8 /* ConvOp.swift */; }; + FC039BAA20E11CBC0081E9F8 /* ElementwiseAddOp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BA520E11CBC0081E9F8 /* ElementwiseAddOp.swift */; }; + FC039BAB20E11CBC0081E9F8 /* Operator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BA620E11CBC0081E9F8 /* Operator.swift */; }; + FC039BAC20E11CBC0081E9F8 /* BatchNormOp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BA720E11CBC0081E9F8 /* BatchNormOp.swift */; }; + FC039BAD20E11CBC0081E9F8 /* ReluOp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BA820E11CBC0081E9F8 /* ReluOp.swift */; }; + FC039BB820E11CC20081E9F8 /* framework.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BAF20E11CC20081E9F8 /* framework.pb.swift */; }; + FC039BB920E11CC20081E9F8 /* Scope.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BB020E11CC20081E9F8 /* Scope.swift */; }; + FC039BBA20E11CC20081E9F8 /* TensorDesc.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BB120E11CC20081E9F8 /* TensorDesc.swift */; }; + FC039BBB20E11CC20081E9F8 /* ProgramDesc.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BB220E11CC20081E9F8 /* ProgramDesc.swift */; }; + FC039BBC20E11CC20081E9F8 /* VarDesc.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BB320E11CC20081E9F8 /* VarDesc.swift */; }; + FC039BBD20E11CC20081E9F8 /* Program.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BB420E11CC20081E9F8 /* Program.swift */; }; + FC039BBE20E11CC20081E9F8 /* OpDesc.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BB520E11CC20081E9F8 /* OpDesc.swift */; }; + FC039BBF20E11CC20081E9F8 /* Attribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BB620E11CC20081E9F8 /* Attribute.swift */; }; + FC039BC020E11CC20081E9F8 /* BlockDesc.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039BB720E11CC20081E9F8 /* BlockDesc.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + CDF58151D902A1CBAE56A0C2 /* Pods-paddle-mobile.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-paddle-mobile.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-paddle-mobile/Pods-paddle-mobile.debug.xcconfig"; sourceTree = ""; }; + DD2E06330A1E7129C918DB46 /* Pods_paddle_mobile.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_paddle_mobile.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E2A7957C92EDA5C3BEC0FFC2 /* Pods-paddle-mobile.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-paddle-mobile.release.xcconfig"; path = "../Pods/Target Support Files/Pods-paddle-mobile/Pods-paddle-mobile.release.xcconfig"; sourceTree = ""; }; + FC039B6A20E11C3C0081E9F8 /* paddle_mobile.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = paddle_mobile.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FC039B6D20E11C3C0081E9F8 /* paddle_mobile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = paddle_mobile.h; sourceTree = ""; }; + FC039B6E20E11C3C0081E9F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FC039B9420E11C9A0081E9F8 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + FC039B9520E11C9A0081E9F8 /* Errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = ""; }; + FC039B9620E11C9A0081E9F8 /* Types.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Types.swift; sourceTree = ""; }; + FC039B9A20E11CA00081E9F8 /* Executor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Executor.swift; sourceTree = ""; }; + FC039B9D20E11CB20081E9F8 /* Tensor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tensor.swift; sourceTree = ""; }; + FC039B9E20E11CB20081E9F8 /* Dim.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dim.swift; sourceTree = ""; }; + FC039BA120E11CB70081E9F8 /* Loader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Loader.swift; sourceTree = ""; }; + FC039BA420E11CBC0081E9F8 /* ConvOp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConvOp.swift; sourceTree = ""; }; + FC039BA520E11CBC0081E9F8 /* ElementwiseAddOp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ElementwiseAddOp.swift; sourceTree = ""; }; + FC039BA620E11CBC0081E9F8 /* Operator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operator.swift; sourceTree = ""; }; + FC039BA720E11CBC0081E9F8 /* BatchNormOp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BatchNormOp.swift; sourceTree = ""; }; + FC039BA820E11CBC0081E9F8 /* ReluOp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReluOp.swift; sourceTree = ""; }; + FC039BAF20E11CC20081E9F8 /* framework.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = framework.pb.swift; sourceTree = ""; }; + FC039BB020E11CC20081E9F8 /* Scope.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Scope.swift; sourceTree = ""; }; + FC039BB120E11CC20081E9F8 /* TensorDesc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TensorDesc.swift; sourceTree = ""; }; + FC039BB220E11CC20081E9F8 /* ProgramDesc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgramDesc.swift; sourceTree = ""; }; + FC039BB320E11CC20081E9F8 /* VarDesc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VarDesc.swift; sourceTree = ""; }; + FC039BB420E11CC20081E9F8 /* Program.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Program.swift; sourceTree = ""; }; + FC039BB520E11CC20081E9F8 /* OpDesc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpDesc.swift; sourceTree = ""; }; + FC039BB620E11CC20081E9F8 /* Attribute.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Attribute.swift; sourceTree = ""; }; + FC039BB720E11CC20081E9F8 /* BlockDesc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockDesc.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FC039B6620E11C3C0081E9F8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3831F70E7E0B565B9AC22DA /* Pods_paddle_mobile.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 336CBE234BF5DE48658DE65F /* Frameworks */ = { + isa = PBXGroup; + children = ( + DD2E06330A1E7129C918DB46 /* Pods_paddle_mobile.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 8EB858F9B68D372C9F1CA263 /* Pods */ = { + isa = PBXGroup; + children = ( + CDF58151D902A1CBAE56A0C2 /* Pods-paddle-mobile.debug.xcconfig */, + E2A7957C92EDA5C3BEC0FFC2 /* Pods-paddle-mobile.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + FC039B6020E11C3C0081E9F8 = { + isa = PBXGroup; + children = ( + FC039B6C20E11C3C0081E9F8 /* paddle-mobile */, + FC039B6B20E11C3C0081E9F8 /* Products */, + 8EB858F9B68D372C9F1CA263 /* Pods */, + 336CBE234BF5DE48658DE65F /* Frameworks */, + ); + sourceTree = ""; + }; + FC039B6B20E11C3C0081E9F8 /* Products */ = { + isa = PBXGroup; + children = ( + FC039B6A20E11C3C0081E9F8 /* paddle_mobile.framework */, + ); + name = Products; + sourceTree = ""; + }; + FC039B6C20E11C3C0081E9F8 /* paddle-mobile */ = { + isa = PBXGroup; + children = ( + FC039BAE20E11CC20081E9F8 /* Program */, + FC039BA320E11CBC0081E9F8 /* Operators */, + FC039BA120E11CB70081E9F8 /* Loader.swift */, + FC039B9C20E11CB20081E9F8 /* framework */, + FC039B9A20E11CA00081E9F8 /* Executor.swift */, + FC039B9320E11C9A0081E9F8 /* Common */, + FC039B6D20E11C3C0081E9F8 /* paddle_mobile.h */, + FC039B6E20E11C3C0081E9F8 /* Info.plist */, + ); + path = "paddle-mobile"; + sourceTree = ""; + }; + FC039B9320E11C9A0081E9F8 /* Common */ = { + isa = PBXGroup; + children = ( + FC039B9420E11C9A0081E9F8 /* Extensions.swift */, + FC039B9520E11C9A0081E9F8 /* Errors.swift */, + FC039B9620E11C9A0081E9F8 /* Types.swift */, + ); + path = Common; + sourceTree = ""; + }; + FC039B9C20E11CB20081E9F8 /* framework */ = { + isa = PBXGroup; + children = ( + FC039B9D20E11CB20081E9F8 /* Tensor.swift */, + FC039B9E20E11CB20081E9F8 /* Dim.swift */, + ); + path = framework; + sourceTree = ""; + }; + FC039BA320E11CBC0081E9F8 /* Operators */ = { + isa = PBXGroup; + children = ( + FC039BA420E11CBC0081E9F8 /* ConvOp.swift */, + FC039BA520E11CBC0081E9F8 /* ElementwiseAddOp.swift */, + FC039BA620E11CBC0081E9F8 /* Operator.swift */, + FC039BA720E11CBC0081E9F8 /* BatchNormOp.swift */, + FC039BA820E11CBC0081E9F8 /* ReluOp.swift */, + ); + path = Operators; + sourceTree = ""; + }; + FC039BAE20E11CC20081E9F8 /* Program */ = { + isa = PBXGroup; + children = ( + FC039BAF20E11CC20081E9F8 /* framework.pb.swift */, + FC039BB020E11CC20081E9F8 /* Scope.swift */, + FC039BB120E11CC20081E9F8 /* TensorDesc.swift */, + FC039BB220E11CC20081E9F8 /* ProgramDesc.swift */, + FC039BB320E11CC20081E9F8 /* VarDesc.swift */, + FC039BB420E11CC20081E9F8 /* Program.swift */, + FC039BB520E11CC20081E9F8 /* OpDesc.swift */, + FC039BB620E11CC20081E9F8 /* Attribute.swift */, + FC039BB720E11CC20081E9F8 /* BlockDesc.swift */, + ); + path = Program; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + FC039B6720E11C3C0081E9F8 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + FC039B6F20E11C3C0081E9F8 /* paddle_mobile.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + FC039B6920E11C3C0081E9F8 /* paddle-mobile */ = { + isa = PBXNativeTarget; + buildConfigurationList = FC039B7220E11C3C0081E9F8 /* Build configuration list for PBXNativeTarget "paddle-mobile" */; + buildPhases = ( + AF33BB8D0770A77AC22B5EF4 /* [CP] Check Pods Manifest.lock */, + FC039B6520E11C3C0081E9F8 /* Sources */, + FC039B6620E11C3C0081E9F8 /* Frameworks */, + FC039B6720E11C3C0081E9F8 /* Headers */, + FC039B6820E11C3C0081E9F8 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "paddle-mobile"; + productName = "paddle-mobile"; + productReference = FC039B6A20E11C3C0081E9F8 /* paddle_mobile.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FC039B6120E11C3C0081E9F8 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0930; + ORGANIZATIONNAME = orange; + TargetAttributes = { + FC039B6920E11C3C0081E9F8 = { + CreatedOnToolsVersion = 9.3.1; + }; + }; + }; + buildConfigurationList = FC039B6420E11C3C0081E9F8 /* Build configuration list for PBXProject "paddle-mobile" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = FC039B6020E11C3C0081E9F8; + productRefGroup = FC039B6B20E11C3C0081E9F8 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FC039B6920E11C3C0081E9F8 /* paddle-mobile */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + FC039B6820E11C3C0081E9F8 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + AF33BB8D0770A77AC22B5EF4 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-paddle-mobile-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + FC039B6520E11C3C0081E9F8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FC039B9F20E11CB20081E9F8 /* Tensor.swift in Sources */, + FC039BAA20E11CBC0081E9F8 /* ElementwiseAddOp.swift in Sources */, + FC039B9B20E11CA00081E9F8 /* Executor.swift in Sources */, + FC039BBB20E11CC20081E9F8 /* ProgramDesc.swift in Sources */, + FC039BBA20E11CC20081E9F8 /* TensorDesc.swift in Sources */, + FC039BA020E11CB20081E9F8 /* Dim.swift in Sources */, + FC039BB820E11CC20081E9F8 /* framework.pb.swift in Sources */, + FC039B9920E11C9A0081E9F8 /* Types.swift in Sources */, + FC039BA920E11CBC0081E9F8 /* ConvOp.swift in Sources */, + FC039B9820E11C9A0081E9F8 /* Errors.swift in Sources */, + FC039BBF20E11CC20081E9F8 /* Attribute.swift in Sources */, + FC039BB920E11CC20081E9F8 /* Scope.swift in Sources */, + FC039BAC20E11CBC0081E9F8 /* BatchNormOp.swift in Sources */, + FC039BBC20E11CC20081E9F8 /* VarDesc.swift in Sources */, + FC039BAB20E11CBC0081E9F8 /* Operator.swift in Sources */, + FC039BBD20E11CC20081E9F8 /* Program.swift in Sources */, + FC039BA220E11CB70081E9F8 /* Loader.swift in Sources */, + FC039BC020E11CC20081E9F8 /* BlockDesc.swift in Sources */, + FC039BAD20E11CBC0081E9F8 /* ReluOp.swift in Sources */, + FC039BBE20E11CC20081E9F8 /* OpDesc.swift in Sources */, + FC039B9720E11C9A0081E9F8 /* Extensions.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + FC039B7020E11C3C0081E9F8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + FC039B7120E11C3C0081E9F8 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + FC039B7320E11C3C0081E9F8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CDF58151D902A1CBAE56A0C2 /* Pods-paddle-mobile.debug.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = Z5M2UUN5YV; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "paddle-mobile/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "orange.paddle-mobile"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + FC039B7420E11C3C0081E9F8 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E2A7957C92EDA5C3BEC0FFC2 /* Pods-paddle-mobile.release.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = Z5M2UUN5YV; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "paddle-mobile/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "orange.paddle-mobile"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FC039B6420E11C3C0081E9F8 /* Build configuration list for PBXProject "paddle-mobile" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FC039B7020E11C3C0081E9F8 /* Debug */, + FC039B7120E11C3C0081E9F8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FC039B7220E11C3C0081E9F8 /* Build configuration list for PBXNativeTarget "paddle-mobile" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FC039B7320E11C3C0081E9F8 /* Debug */, + FC039B7420E11C3C0081E9F8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FC039B6120E11C3C0081E9F8 /* Project object */; +} diff --git a/metal/paddle-mobile/paddle-mobile.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/metal/paddle-mobile/paddle-mobile.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000000000000000000000000000000000..bb84e46b46d8c2c496c068dc15f2304785ed8e31 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/metal/paddle-mobile/paddle-mobile.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/metal/paddle-mobile/paddle-mobile.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000000000000000000000000000000000..18d981003d68d0546c4804ac2ff47dd97c6e7921 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/metal/paddle-mobile/paddle-mobile.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate b/metal/paddle-mobile/paddle-mobile.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..6b9abef67c5d123b4fb22117ed3f4f575de52aa0 Binary files /dev/null and b/metal/paddle-mobile/paddle-mobile.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist b/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000000000000000000000000000000000000..52725213607bd68fccbd4aa63faa9294cb622962 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + paddle-mobile.xcscheme + + orderHint + 3 + + + + diff --git a/metal/paddle-mobile/paddle-mobile/Common/Errors.swift b/metal/paddle-mobile/paddle-mobile/Common/Errors.swift new file mode 100644 index 0000000000000000000000000000000000000000..d086fe357443b6549137c46ef78813c40e111815 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Common/Errors.swift @@ -0,0 +1,22 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +public enum PaddleMobileError: Error{ + case loaderError(message: String) + case netError(message: String) + case memoryError(message: String) + case paramError(message: String) +} diff --git a/metal/paddle-mobile/paddle-mobile/Common/Extensions.swift b/metal/paddle-mobile/paddle-mobile/Common/Extensions.swift new file mode 100644 index 0000000000000000000000000000000000000000..d23b1d93000bee37b8bc08e018c5c82577f7a3c3 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Common/Extensions.swift @@ -0,0 +1,95 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +// 自定义 ?! 如果 ?! 前的返回值为一个可选值, 则进行隐式解包, 如果有值则返回这个值, 如果为nil 则fatalError 传入的信息 +precedencegroup ExecutedOrFatalError{ + associativity: left + higherThan: AssignmentPrecedence +} +infix operator ?!: ExecutedOrFatalError +func ?!(option: T?, excuteOrError: @autoclosure () -> String) -> T{ + if let inOpt = option { + return inOpt + }else{ + fatalError(excuteOrError()) + } +} + +//Lense +struct Lense { + let from: (A) -> B + let to: (B, A) -> A +} + +precedencegroup CombineLense{ + associativity: left + higherThan: AssignmentPrecedence +} + +infix operator >>>: CombineLense +func >>>(left: Lense, right: Lense) -> Lense { + return Lense.init(from: { (a) -> C in + left.from(right.from(a)) + }, to: { (c, a) -> A in + right.to( left.to(c, right.from(a)),a) + }) +} + +protocol CIntIndex { + associatedtype T; + subscript(index: CInt) -> T { get set}; +} + +extension Array: CIntIndex{ + typealias T = Element + subscript(index: CInt) -> T { + get{ + guard Int64(Int.max) >= Int64(index) else{ + fatalError("cint index out of Int range") + } + return self[Int(index)] + } + set{ + guard Int64(Int.max) >= Int64(index) else{ + fatalError("cint index out of Int range") + } + self[Int(index)] = newValue + } + + } +} + + +//MARK: Array extension +extension Array where Element: Comparable{ + + /// 返回数组前 r 个元素, 并将元素处于原数组的位置作为元组的第一个元素返回 + /// + /// - Parameter r: 前 r 个元素 + /// - Returns: [(原有位置, 排好位置的元素)] + func top(r: Int) -> [(Int, Element)] { + precondition(r <= self.count) + return Array<(Int, Element)>(zip(0.. $1.1 }.prefix(through: r - 1)) + } +} + +extension String{ + func cStr() -> UnsafePointer? { + return (self as NSString).utf8String + } +} + + diff --git a/metal/paddle-mobile/paddle-mobile/Common/Types.swift b/metal/paddle-mobile/paddle-mobile/Common/Types.swift new file mode 100644 index 0000000000000000000000000000000000000000..531a41ed622b077edfd8685fec25a2eeb0e21f5b --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Common/Types.swift @@ -0,0 +1,50 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +//typealias Float16 = Int16 +//extension Float16: PrecisionType { +//} + +public protocol PrecisionType { +} + +extension Float32: PrecisionType { +} + +enum DataLayout { + case NCHW + case NHWC +} + +protocol Variant { +} + +extension Tensor: Variant { + +} + + + +let gConvType = "conv2d" +let gBatchNormType = "batch_norm" +let gReluType = "relu" +let gElementwiseAdd = "elementwise_add" + +let opInputsOutputsKey = [gConvType : (inputs: ["Input"], outputs: ["Output"]), + gBatchNormType : (inputs: ["X"], outputs: ["Y"]), + gReluType : (inputs: ["X"], outputs: ["Out"]), + gElementwiseAdd : (inputs: ["X", "Y"], outputs: ["Out"])] + diff --git a/metal/paddle-mobile/paddle-mobile/Executor.swift b/metal/paddle-mobile/paddle-mobile/Executor.swift new file mode 100644 index 0000000000000000000000000000000000000000..76b4e1bc5ade26abef906e7af0092d9539690c22 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Executor.swift @@ -0,0 +1,19 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +class Executor { + +} diff --git a/metal/paddle-mobile/paddle-mobile/Info.plist b/metal/paddle-mobile/paddle-mobile/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..1007fd9dd7d0af3071eced72a45c88fea7665976 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/metal/paddle-mobile/paddle-mobile/Loader.swift b/metal/paddle-mobile/paddle-mobile/Loader.swift new file mode 100644 index 0000000000000000000000000000000000000000..f5275d37417c0a277aed04b720ba09c25e063685 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Loader.swift @@ -0,0 +1,205 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation +import SwiftProtobuf + +class ParamData { + let size: Int + var dim: Dim + private(set) var layout: DataLayout + var pointer: UnsafeMutablePointer

+ init(inDim: Dim, inLayout: DataLayout = .NCHW) { + dim = inDim + size = inDim.numel() * MemoryLayout

.size + pointer = UnsafeMutablePointer

.allocate(capacity: size) + layout = inLayout + } + + func convert(to: DataLayout) { + guard to != layout else { + return + } + + guard dim.cout() == 4 else { + return + } + + guard layout == .NCHW && to == .NHWC else { + // other not support + return + } + let newPointer = UnsafeMutablePointer

.allocate(capacity: size) + + if layout == .NCHW { + NCHW2NHWC(newPtr: newPointer) + } + + pointer.deinitialize(count: size) + pointer.deallocate() + pointer = newPointer + layout = to + } + + func NCHW2NHWC(newPtr: UnsafeMutablePointer

) { + let N = dim[0] + let C = dim[1] + let H = dim[2] + let W = dim[3] + let HXW = H * W + let CXHXW = C * H * W + + var index: Int = 0 + for n in 0.. { + class ParaLoader { + let file: UnsafeMutablePointer + let fileSize: Int + var nowIndex: Int + init(paramPath: String) throws { + guard let tmpFile = fopen(paramPath, "rb") else { + throw PaddleMobileError.loaderError(message: "open param file error" + paramPath) + } + file = tmpFile + fseek(file, 0, SEEK_END) + fileSize = ftell(file) + guard fileSize > 0 else { + throw PaddleMobileError.loaderError(message: "param file size is too small") + } + rewind(file) + nowIndex = 0 + } + + func read(data: ParamData

) throws { + guard nowIndex <= fileSize else { + throw PaddleMobileError.loaderError(message: "out of the file range") + } + + func pointerReader(type: T.Type) -> T { + let ptr = UnsafeMutablePointer.allocate(capacity: MemoryLayout.size) + fread(ptr, 1, MemoryLayout.size, file) + nowIndex += MemoryLayout.size + let pointee = ptr.pointee + ptr.deinitialize(count: MemoryLayout.size) + ptr.deallocate() + return pointee + } + + _ = pointerReader(type: UInt32.self) + let lodLevel = pointerReader(type: UInt64.self) + for _ in 0...size)){ + _ = pointerReader(type: size_t.self) + } + } + + let _ = pointerReader(type: UInt32.self) + + let tensorDescSize = pointerReader(type: Int32.self) + fseek(file, Int(tensorDescSize), SEEK_CUR) + nowIndex += Int(tensorDescSize) + + /* + 这里没有根据 Data Type 去判断, 而是从外部泛型直接指定了精度 + */ + + let bytesRead = fread(data.pointer, 1, data.size, file) + guard bytesRead == data.size else { + throw PaddleMobileError.loaderError(message: "param read size error") + } + nowIndex += bytesRead + } + + deinit { + fclose(file) + } + } + public init(){} + public func load(modelPath: String, paraPath: String) throws -> Program{ + guard let modelData = try? Data.init(contentsOf: URL.init(fileURLWithPath: modelPath)) else { + throw PaddleMobileError.loaderError(message: "load " + modelPath + " failed !") + } + + do { + let protoProgram = try PaddleMobile_Framework_Proto_ProgramDesc.init( + serializedData: modelData) + let scope = Scope.init() + let program = Program.init(protoProgramDesc: protoProgram, inParamPath: paraPath, inScope: scope) + + guard let paraLoader = try? ParaLoader.init(paramPath: paraPath) else { + throw PaddleMobileError.loaderError(message: "load para error") + } + + for block in program.programDesc.blocks { + for varDesc in block.vars { + if (varDesc.type == .LodTensor) { + if (varDesc.persistable + && varDesc.type != .FeedMiniBatch + && varDesc.type != .FetchList) { + guard let tensorDesc = varDesc.tensorDesc else { + throw PaddleMobileError.loaderError(message: "get tensor desc failed") + } + + guard (try? tensorDesc.dataType.dataTypeSize()) == MemoryLayout

.size else { + throw PaddleMobileError.memoryError(message: "PrecisionType not support") + } + + let dimArr = tensorDesc.dims + + + guard dimArr.count > 0 else { + throw PaddleMobileError.loaderError(message: "tensor desc dim size error") + } + + let dim = Dim.init(inDim: dimArr) + let paraData = ParamData

.init(inDim: dim) + do { + try paraLoader.read(data: paraData) + } catch let error { + throw error + } + paraData.convert(to: .NHWC) + let tensor = Tensor

.init(inData: paraData) + scope.vars[varDesc.name] = tensor + } + } + } + } + return program + } catch _ { + throw PaddleMobileError.loaderError(message: "protobuf decoder error") + } + } +} diff --git a/metal/paddle-mobile/paddle-mobile/Operators/BatchNormOp.swift b/metal/paddle-mobile/paddle-mobile/Operators/BatchNormOp.swift new file mode 100644 index 0000000000000000000000000000000000000000..44a1d778664f4713469575f31a4386662a6d2779 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Operators/BatchNormOp.swift @@ -0,0 +1,47 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +struct BatchNormParam: Param { + typealias ParamP = P + init(opDesc: OpDesc, scope: Scope) throws { + do { + inputX = try BatchNormParam.inputX(inputs: opDesc.inputs, from: scope) + outputY = try BatchNormParam.outputY(outputs: opDesc.outputs, from: scope) + inputBias = try BatchNormParam.inputBiase(inputs: opDesc.paraInputs, from: scope) + inputMean = try BatchNormParam.inputMean(inputs: opDesc.paraInputs, from: scope) + inputScale = try BatchNormParam.inputScale(inputs: opDesc.paraInputs, from: scope) + inputVariance = try BatchNormParam.inputVariance(inputs: opDesc.paraInputs, from: scope) + epsilon = try BatchNormParam.getAttr(key: "epsilon", attrs: opDesc.attrs) + momentum = try BatchNormParam.getAttr(key: "momentum", attrs: opDesc.attrs) + is_test = try BatchNormParam.getAttr(key: "is_test", attrs: opDesc.attrs) + } catch let error { + throw error + } + } + let inputX: Tensor + let outputY: Tensor + let inputBias: Tensor + let inputMean: Tensor + let inputScale: Tensor + let inputVariance: Tensor + let epsilon: Float + let momentum: Float + let is_test: Bool +} + +class BatchNormOp: Operator> { + +} diff --git a/metal/paddle-mobile/paddle-mobile/Operators/ConvOp.swift b/metal/paddle-mobile/paddle-mobile/Operators/ConvOp.swift new file mode 100644 index 0000000000000000000000000000000000000000..ab8e23463166a27dddb3fda8514149adb44e2af8 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Operators/ConvOp.swift @@ -0,0 +1,46 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +struct ConvParam: Param { + typealias ParamP = P + init(opDesc: OpDesc, scope: Scope) throws { + do { + filter = try ConvParam.inputFilter(paraInputs: opDesc.paraInputs, from: scope) + input = try ConvParam.input(inputs: opDesc.inputs, from: scope) + output = try ConvParam.output(outputs: opDesc.outputs, from: scope) + stride = try ConvParam.getAttr(key: "stride", attrs: opDesc.attrs) + paddings = try ConvParam.getAttr(key: "paddings", attrs: opDesc.attrs) + dilations = try ConvParam.getAttr(key: "dilations", attrs: opDesc.attrs) + groups = try ConvParam.getAttr(key: "groups", attrs: opDesc.attrs) + } catch let error { + throw error + } + } + + let input: Tensor + let output: Tensor + let filter: Tensor + let stride: [Int] + let paddings: [Int] + let dilations: [Int] + let groups: Int +} + +class ConvOp: Operator> { + override func runImpl() { + + } +} diff --git a/metal/paddle-mobile/paddle-mobile/Operators/ElementwiseAddOp.swift b/metal/paddle-mobile/paddle-mobile/Operators/ElementwiseAddOp.swift new file mode 100644 index 0000000000000000000000000000000000000000..d87b49d2c13a1e34ff1ea2b7d2b957fff432541d --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Operators/ElementwiseAddOp.swift @@ -0,0 +1,38 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ +import Foundation + +struct ElementwiseAddParam: Param { + typealias ParamP = P + init(opDesc: OpDesc, scope: Scope) throws { + do { + inputX = try ElementwiseAddParam.inputX(inputs: opDesc.inputs, from: scope) + inputY = try ElementwiseAddParam.inputY(inputs: opDesc.inputs, from: scope) + out = try ElementwiseAddParam.outputOut(outputs: opDesc.outputs, from: scope) + axis = try ElementwiseAddParam.getAttr(key: "axis", attrs: opDesc.attrs) + } catch let error { + throw error + } + } + let inputX: Tensor

+ let inputY: Tensor

+ let out: Tensor

+ let axis: Int +} + +class ElementwiseAddOp: Operator>{ + override func runImpl() { + + } +} diff --git a/metal/paddle-mobile/paddle-mobile/Operators/Operator.swift b/metal/paddle-mobile/paddle-mobile/Operators/Operator.swift new file mode 100644 index 0000000000000000000000000000000000000000..427d60d6eb59e0a09c32160242920bcd40195d02 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Operators/Operator.swift @@ -0,0 +1,182 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +/* + let opInputsOutputsKey = [gConvType : (inputs: ["Input"], outputs: ["Output"]), + gBatchNormType : (inputs: ["X"], outputs: ["Y"]), + gReluType : (inputs: ["X"], outputs: ["Out"]), + gElementwiseAdd : (inputs: ["X", "Y"], outputs: ["Out"])] + */ + +protocol Param { + associatedtype ParamP: PrecisionType + init(opDesc: OpDesc, scope: Scope) throws + static func getFirstTensor(key: String, map: [String : [String]], from: Scope) throws -> Tensor + static func inputX(inputs: [String : [String]], from: Scope) throws -> Tensor + static func inputBiase(inputs: [String : [String]], from: Scope) throws -> Tensor + static func inputMean(inputs: [String : [String]], from: Scope) throws -> Tensor + static func inputScale(inputs: [String : [String]], from: Scope) throws -> Tensor + static func inputVariance(inputs: [String : [String]], from: Scope) throws -> Tensor + static func inputFilter(paraInputs: [String : [String]], from: Scope) throws -> Tensor + static func input(inputs: [String : [String]], from: Scope) throws -> Tensor + static func output(outputs: [String : [String]], from: Scope) throws -> Tensor + static func outputY(outputs: [String : [String]], from: Scope) throws -> Tensor + static func inputY(inputs: [String : [String]], from: Scope) throws -> Tensor + static func outputOut(outputs: [String : [String]], from: Scope) throws -> Tensor + static func getAttr(key: String, attrs: [String : Attr]) throws -> T +} + +extension Param { + static func getFirstTensor(key: String, map: [String : [String]], from: Scope) throws -> Tensor { + guard let mapKeys = map["X"], mapKeys.count > 0, let inputX = from[mapKeys[0]], let tensorX = inputX as? Tensor else { + throw PaddleMobileError.paramError(message: "tensor " + key + "in \(map) not found") + } + return tensorX + } + + static func inputX(inputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorX = try getFirstTensor(key: "X", map: inputs, from: from) + return tensorX + } catch let error { + throw error + } + } + + static func input(inputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorInput = try getFirstTensor(key: "Input", map: inputs, from: from) + return tensorInput + } catch let error { + throw error + } + } + + static func output(outputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorOutput = try getFirstTensor(key: "Output", map: outputs, from: from) + return tensorOutput + } catch let error { + throw error + } + } + static func outputY(outputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorOutputY = try getFirstTensor(key: "Y", map: outputs, from: from) + return tensorOutputY + } catch let error { + throw error + } + } + static func inputY(inputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorY = try getFirstTensor(key: "Y", map: inputs, from: from) + return tensorY + } catch let error { + throw error + } + } + + static func outputOut(outputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let out = try getFirstTensor(key: "Out", map: outputs, from: from) + return out + } catch let error { + throw error + } + } + static func inputFilter(paraInputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorFilter = try getFirstTensor(key: "Filter", map: paraInputs, from: from) + return tensorFilter + } catch let error { + throw error + } + } + + static func inputBiase(inputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorBias = try getFirstTensor(key: "Bias", map: inputs, from: from) + return tensorBias + } catch let error { + throw error + } + } + + static func inputMean(inputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorMean = try getFirstTensor(key: "Mean", map: inputs, from: from) + return tensorMean + } catch let error { + throw error + } + } + + static func inputScale(inputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorScale = try getFirstTensor(key: "Scale", map: inputs, from: from) + return tensorScale + } catch let error { + throw error + } + } + + static func inputVariance(inputs: [String : [String]], from: Scope) throws -> Tensor { + do { + let tensorVariance = try getFirstTensor(key: "Variance", map: inputs, from: from) + return tensorVariance + } catch let error { + throw error + } + } + + static func getAttr(key: String, attrs: [String : Attr]) throws -> T{ + guard let attr = attrs[key] as? T else { + throw PaddleMobileError.paramError(message: "attr type error") + } + return attr + } +} + + +class Operator { + let type: String + let inputs: [String : [String]] + let paraInputs: [String : [String]] + let outpus: [String : [String]] + let attrs: [String : Attr] + let para: ParamType + init(opDesc: OpDesc, inScope: Scope) throws { + type = opDesc.type + inputs = opDesc.inputs + outpus = opDesc.outputs + attrs = opDesc.attrs + paraInputs = opDesc.paraInputs + do { + para = try ParamType.init(opDesc:opDesc, scope: inScope) + } catch let error { + throw error + } + } + + func run() { + runImpl() + } + + func runImpl() { + fatalError("runimpl of " + type + "op not implement") + } +} diff --git a/metal/paddle-mobile/paddle-mobile/Operators/ReluOp.swift b/metal/paddle-mobile/paddle-mobile/Operators/ReluOp.swift new file mode 100644 index 0000000000000000000000000000000000000000..291d728dbf3c173a2c4a114bcc7885b76a3d12c3 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Operators/ReluOp.swift @@ -0,0 +1,37 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ +import Foundation + +struct ReluParam: Param { + typealias ParamP = P + init(opDesc: OpDesc, scope: Scope) throws { + do { + inputX = try ReluParam.inputX(inputs: opDesc.inputs, from: scope) + out = try ReluParam.outputOut(outputs: opDesc.outputs, from: scope) + } catch let error { + throw error + } + } + let inputX: Tensor + let out: Tensor +} + +class ReluOp: Operator> { + override func runImpl() { + + } +} + + + diff --git a/metal/paddle-mobile/paddle-mobile/Program/Attribute.swift b/metal/paddle-mobile/paddle-mobile/Program/Attribute.swift new file mode 100644 index 0000000000000000000000000000000000000000..924f92ddd5d5735e16157b00e38854e8fa0a9d35 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Program/Attribute.swift @@ -0,0 +1,58 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +protocol Attr { +} + +extension Bool: Attr { +} + +extension Int: Attr { +} + +extension Float: Attr { +} + +extension Int64: Attr { +} + +extension Array: Attr { +} + +func attrWithProtoDesc(attrDesc: PaddleMobile_Framework_Proto_OpDesc.Attr) -> Attr { + switch attrDesc.type { + case .boolean: + return attrDesc.b + case .int: + return Int(attrDesc.i) + case .string: + return attrDesc.strings + case .long: + return attrDesc.l + case .float: + return attrDesc.f + case .booleans: + return attrDesc.bools + case .floats: + return attrDesc.floats + case .ints: + return attrDesc.ints + case .strings: + return attrDesc.strings + default: + fatalError(" not support this attr type: \(attrDesc.type)") + } +} diff --git a/metal/paddle-mobile/paddle-mobile/Program/BlockDesc.swift b/metal/paddle-mobile/paddle-mobile/Program/BlockDesc.swift new file mode 100644 index 0000000000000000000000000000000000000000..630ca3de4c50fc1b275117fe6553c0646e8ef709 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Program/BlockDesc.swift @@ -0,0 +1,41 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +struct BlockDesc { + let index: Int + let parentIndex: Int + let vars: [VarDesc] + let ops: [OpDesc] + init(block: PaddleMobile_Framework_Proto_BlockDesc) { + index = Int(block.idx) + parentIndex = Int(block.parentIdx) + var vars: [VarDesc] = [] + for varOfBlock in block.vars { + vars.append(VarDesc.init(protoVarDesc: varOfBlock)) + } + vars.sort { $0.name < $1.name } + self.vars = vars + var ops: [OpDesc] = [] + for op in block.ops { + ops.append(OpDesc.init(protoOpDesc: op)) + } + self.ops = ops + } + + + + +} diff --git a/metal/paddle-mobile/paddle-mobile/Program/OpDesc.swift b/metal/paddle-mobile/paddle-mobile/Program/OpDesc.swift new file mode 100644 index 0000000000000000000000000000000000000000..48f43776461a2160778a26c5ff438d508b9f6345 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Program/OpDesc.swift @@ -0,0 +1,58 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +struct OpDesc { + let inputs: [String : [String]] + let paraInputs: [String : [String]] + let outputs: [String : [String]] + let unusedOutputs: [String : [String]] + var attrs: [String : Attr] = [:] + let type: String + init(protoOpDesc: PaddleMobile_Framework_Proto_OpDesc) { + type = protoOpDesc.type + let creator = { (vars: [PaddleMobile_Framework_Proto_OpDesc.Var], canAdd: (String) -> Bool) -> [String : [String]] in + var map: [String : [String]] = [:] + for opDescVar in vars { + if (canAdd(opDescVar.parameter)) { + map[opDescVar.parameter] = opDescVar.arguments + } + } + return map + } + + inputs = creator(protoOpDesc.inputs) { + opInputsOutputsKey[protoOpDesc.type]?.inputs.contains($0) ?? false + } + + paraInputs = creator(protoOpDesc.inputs) { + !(opInputsOutputsKey[protoOpDesc.type]?.inputs.contains($0) ?? false) + } + + outputs = creator(protoOpDesc.outputs) { + opInputsOutputsKey[protoOpDesc.type]?.outputs.contains($0) ?? false + } + + unusedOutputs = creator(protoOpDesc.outputs) { + !(opInputsOutputsKey[protoOpDesc.type]?.outputs.contains($0) ?? false) + } + + for attr in protoOpDesc.attrs { + if (attr.type != .block) { + attrs[attr.name] = attrWithProtoDesc(attrDesc: attr) + } + } + } +} diff --git a/metal/paddle-mobile/paddle-mobile/Program/Program.swift b/metal/paddle-mobile/paddle-mobile/Program/Program.swift new file mode 100644 index 0000000000000000000000000000000000000000..a346af8304688ba766928c6c6132dc7b840e683d --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Program/Program.swift @@ -0,0 +1,26 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +public struct Program { + let paramPath: String + let programDesc: ProgramDesc + let scope: Scope + init(protoProgramDesc: PaddleMobile_Framework_Proto_ProgramDesc, inParamPath: String, inScope: Scope) { + programDesc = ProgramDesc.init(protoProgram: protoProgramDesc) + paramPath = inParamPath + scope = inScope + } +} diff --git a/metal/paddle-mobile/paddle-mobile/Program/ProgramDesc.swift b/metal/paddle-mobile/paddle-mobile/Program/ProgramDesc.swift new file mode 100644 index 0000000000000000000000000000000000000000..5e80037e5e8a6cca83f6e87842a45410db174245 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Program/ProgramDesc.swift @@ -0,0 +1,24 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +public struct ProgramDesc { + var blocks: [BlockDesc] = [] + init(protoProgram: PaddleMobile_Framework_Proto_ProgramDesc) { + for block in protoProgram.blocks { + self.blocks.append(BlockDesc.init(block: block)) + } + } +} diff --git a/metal/paddle-mobile/paddle-mobile/Program/Scope.swift b/metal/paddle-mobile/paddle-mobile/Program/Scope.swift new file mode 100644 index 0000000000000000000000000000000000000000..0f34ed20ddf7feed4e22c8ce330a3343a41edc93 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Program/Scope.swift @@ -0,0 +1,23 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +class Scope { + var vars: [String : Variant] = [:] + subscript(key: String) -> Variant?{ + return vars[key] + } + +} diff --git a/metal/paddle-mobile/paddle-mobile/Program/TensorDesc.swift b/metal/paddle-mobile/paddle-mobile/Program/TensorDesc.swift new file mode 100644 index 0000000000000000000000000000000000000000..f6457c5355fa62ab249767a32e5d4a7d9620511a --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Program/TensorDesc.swift @@ -0,0 +1,25 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +struct TensorDesc { + let dims: [Int] + let dataType: VarTypeType + init(protoTensorDesc: PaddleMobile_Framework_Proto_VarType.TensorDesc) { + dims = protoTensorDesc.dims.map{ Int($0)} + dataType = VarTypeType.init(rawValue: protoTensorDesc.dataType.rawValue) ?? .ErrorType + } + +} diff --git a/metal/paddle-mobile/paddle-mobile/Program/VarDesc.swift b/metal/paddle-mobile/paddle-mobile/Program/VarDesc.swift new file mode 100644 index 0000000000000000000000000000000000000000..a3cef09bfe369758f0acea8c8c27abb27d010220 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Program/VarDesc.swift @@ -0,0 +1,80 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +enum VarTypeType: Int { + case ErrorType = -1, + Bool = 0, + Int16 = 1, + Int32 = 2, + Int64 = 3, + FP16 = 4, + FP32 = 5, + FP64 = 6, + LodTensor = 7, + SelectedRows = 8, + FeedMiniBatch = 9, + FetchList = 10, + StepScopes = 11, + StepLodRankTable = 12, + StepLodTensorArray = 13, + StepPlaceList = 14, + Reader = 15, + Channel = 16, + Raw = 17, + Tuple = 18 + + func dataTypeSize() throws -> Int { + switch self { + case .FP16: + return 2 + case .FP32: + return 4 + case .FP64: + return 8 + case .Int32: + return 4 + case .Int64: + return 8 + case .Bool: + return 1 + default: + throw PaddleMobileError.memoryError(message: "not support \(self) type to get size ") + } + } +} + +struct VarDesc { + let name: String + let persistable: Bool + let type: VarTypeType + let tensorDesc: TensorDesc? + init(protoVarDesc: PaddleMobile_Framework_Proto_VarDesc) { + type = VarTypeType.init(rawValue: protoVarDesc.type.type.rawValue) ?? .ErrorType + name = protoVarDesc.name + persistable = protoVarDesc.persistable + switch type { + case .SelectedRows: + tensorDesc = TensorDesc.init(protoTensorDesc: protoVarDesc.type.selectedRows) + case .LodTensor: + tensorDesc = TensorDesc.init(protoTensorDesc: protoVarDesc.type.lodTensor.tensor) + case .StepLodTensorArray: + tensorDesc = TensorDesc.init(protoTensorDesc: protoVarDesc.type.tensorArray.tensor); + default: + tensorDesc = .none + } + } + +} diff --git a/metal/paddle-mobile/paddle-mobile/Program/framework.pb.swift b/metal/paddle-mobile/paddle-mobile/Program/framework.pb.swift new file mode 100644 index 0000000000000000000000000000000000000000..df4af3bcc91853e507321d46d3edfd04045f29ab --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/Program/framework.pb.swift @@ -0,0 +1,1821 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: framework.proto +// +// For information on using the generated types, please see the documenation: +// https://github.com/apple/swift-protobuf/ + +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that your are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +enum PaddleMobile_Framework_Proto_AttrType: SwiftProtobuf.Enum { + typealias RawValue = Int + case int // = 0 + case float // = 1 + case string // = 2 + case ints // = 3 + case floats // = 4 + case strings // = 5 + case boolean // = 6 + case booleans // = 7 + case block // = 8 + case long // = 9 + + init() { + self = .int + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .int + case 1: self = .float + case 2: self = .string + case 3: self = .ints + case 4: self = .floats + case 5: self = .strings + case 6: self = .boolean + case 7: self = .booleans + case 8: self = .block + case 9: self = .long + default: return nil + } + } + + var rawValue: Int { + switch self { + case .int: return 0 + case .float: return 1 + case .string: return 2 + case .ints: return 3 + case .floats: return 4 + case .strings: return 5 + case .boolean: return 6 + case .booleans: return 7 + case .block: return 8 + case .long: return 9 + } + } + +} + +/// OpDesc describes an instance of a C++ framework::OperatorBase +/// derived class type. +struct PaddleMobile_Framework_Proto_OpDesc { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: String { + get {return _type ?? String()} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var inputs: [PaddleMobile_Framework_Proto_OpDesc.Var] = [] + + var outputs: [PaddleMobile_Framework_Proto_OpDesc.Var] = [] + + var attrs: [PaddleMobile_Framework_Proto_OpDesc.Attr] = [] + + var isTarget: Bool { + get {return _isTarget ?? false} + set {_isTarget = newValue} + } + /// Returns true if `isTarget` has been explicitly set. + var hasIsTarget: Bool {return self._isTarget != nil} + /// Clears the value of `isTarget`. Subsequent reads from it will return its default value. + mutating func clearIsTarget() {self._isTarget = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct Attr { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {self._name = nil} + + var type: PaddleMobile_Framework_Proto_AttrType { + get {return _type ?? .int} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var i: Int32 { + get {return _i ?? 0} + set {_i = newValue} + } + /// Returns true if `i` has been explicitly set. + var hasI: Bool {return self._i != nil} + /// Clears the value of `i`. Subsequent reads from it will return its default value. + mutating func clearI() {self._i = nil} + + var f: Float { + get {return _f ?? 0} + set {_f = newValue} + } + /// Returns true if `f` has been explicitly set. + var hasF: Bool {return self._f != nil} + /// Clears the value of `f`. Subsequent reads from it will return its default value. + mutating func clearF() {self._f = nil} + + var s: String { + get {return _s ?? String()} + set {_s = newValue} + } + /// Returns true if `s` has been explicitly set. + var hasS: Bool {return self._s != nil} + /// Clears the value of `s`. Subsequent reads from it will return its default value. + mutating func clearS() {self._s = nil} + + var ints: [Int32] = [] + + var floats: [Float] = [] + + var strings: [String] = [] + + var b: Bool { + get {return _b ?? false} + set {_b = newValue} + } + /// Returns true if `b` has been explicitly set. + var hasB: Bool {return self._b != nil} + /// Clears the value of `b`. Subsequent reads from it will return its default value. + mutating func clearB() {self._b = nil} + + var bools: [Bool] = [] + + var blockIdx: Int32 { + get {return _blockIdx ?? 0} + set {_blockIdx = newValue} + } + /// Returns true if `blockIdx` has been explicitly set. + var hasBlockIdx: Bool {return self._blockIdx != nil} + /// Clears the value of `blockIdx`. Subsequent reads from it will return its default value. + mutating func clearBlockIdx() {self._blockIdx = nil} + + var l: Int64 { + get {return _l ?? 0} + set {_l = newValue} + } + /// Returns true if `l` has been explicitly set. + var hasL: Bool {return self._l != nil} + /// Clears the value of `l`. Subsequent reads from it will return its default value. + mutating func clearL() {self._l = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _name: String? = nil + fileprivate var _type: PaddleMobile_Framework_Proto_AttrType? = nil + fileprivate var _i: Int32? = nil + fileprivate var _f: Float? = nil + fileprivate var _s: String? = nil + fileprivate var _b: Bool? = nil + fileprivate var _blockIdx: Int32? = nil + fileprivate var _l: Int64? = nil + } + + struct Var { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var parameter: String { + get {return _parameter ?? String()} + set {_parameter = newValue} + } + /// Returns true if `parameter` has been explicitly set. + var hasParameter: Bool {return self._parameter != nil} + /// Clears the value of `parameter`. Subsequent reads from it will return its default value. + mutating func clearParameter() {self._parameter = nil} + + var arguments: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _parameter: String? = nil + } + + init() {} + + fileprivate var _type: String? = nil + fileprivate var _isTarget: Bool? = nil +} + +/// OpProto describes a C++ framework::OperatorBase derived class. +struct PaddleMobile_Framework_Proto_OpProto { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: String { + get {return _type ?? String()} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var inputs: [PaddleMobile_Framework_Proto_OpProto.Var] = [] + + var outputs: [PaddleMobile_Framework_Proto_OpProto.Var] = [] + + var attrs: [PaddleMobile_Framework_Proto_OpProto.Attr] = [] + + var comment: String { + get {return _comment ?? String()} + set {_comment = newValue} + } + /// Returns true if `comment` has been explicitly set. + var hasComment: Bool {return self._comment != nil} + /// Clears the value of `comment`. Subsequent reads from it will return its default value. + mutating func clearComment() {self._comment = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// VarProto describes the C++ type framework::Variable. + struct Var { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {self._name = nil} + + var comment: String { + get {return _comment ?? String()} + set {_comment = newValue} + } + /// Returns true if `comment` has been explicitly set. + var hasComment: Bool {return self._comment != nil} + /// Clears the value of `comment`. Subsequent reads from it will return its default value. + mutating func clearComment() {self._comment = nil} + + var duplicable: Bool { + get {return _duplicable ?? false} + set {_duplicable = newValue} + } + /// Returns true if `duplicable` has been explicitly set. + var hasDuplicable: Bool {return self._duplicable != nil} + /// Clears the value of `duplicable`. Subsequent reads from it will return its default value. + mutating func clearDuplicable() {self._duplicable = nil} + + var intermediate: Bool { + get {return _intermediate ?? false} + set {_intermediate = newValue} + } + /// Returns true if `intermediate` has been explicitly set. + var hasIntermediate: Bool {return self._intermediate != nil} + /// Clears the value of `intermediate`. Subsequent reads from it will return its default value. + mutating func clearIntermediate() {self._intermediate = nil} + + var dispensable: Bool { + get {return _dispensable ?? false} + set {_dispensable = newValue} + } + /// Returns true if `dispensable` has been explicitly set. + var hasDispensable: Bool {return self._dispensable != nil} + /// Clears the value of `dispensable`. Subsequent reads from it will return its default value. + mutating func clearDispensable() {self._dispensable = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _name: String? = nil + fileprivate var _comment: String? = nil + fileprivate var _duplicable: Bool? = nil + fileprivate var _intermediate: Bool? = nil + fileprivate var _dispensable: Bool? = nil + } + + /// AttrProto describes the C++ type Attribute. + struct Attr { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {self._name = nil} + + var type: PaddleMobile_Framework_Proto_AttrType { + get {return _type ?? .int} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var comment: String { + get {return _comment ?? String()} + set {_comment = newValue} + } + /// Returns true if `comment` has been explicitly set. + var hasComment: Bool {return self._comment != nil} + /// Clears the value of `comment`. Subsequent reads from it will return its default value. + mutating func clearComment() {self._comment = nil} + + /// If that attribute is generated, it means the Paddle third + /// language binding has responsibility to fill that + /// attribute. End-User should not set that attribute. + var generated: Bool { + get {return _generated ?? false} + set {_generated = newValue} + } + /// Returns true if `generated` has been explicitly set. + var hasGenerated: Bool {return self._generated != nil} + /// Clears the value of `generated`. Subsequent reads from it will return its default value. + mutating func clearGenerated() {self._generated = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _name: String? = nil + fileprivate var _type: PaddleMobile_Framework_Proto_AttrType? = nil + fileprivate var _comment: String? = nil + fileprivate var _generated: Bool? = nil + } + + init() {} + + fileprivate var _type: String? = nil + fileprivate var _comment: String? = nil +} + +struct PaddleMobile_Framework_Proto_VarType { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: PaddleMobile_Framework_Proto_VarType.TypeEnum { + get {return _storage._type ?? .bool} + set {_uniqueStorage()._type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return _storage._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {_storage._type = nil} + + var selectedRows: PaddleMobile_Framework_Proto_VarType.TensorDesc { + get {return _storage._selectedRows ?? PaddleMobile_Framework_Proto_VarType.TensorDesc()} + set {_uniqueStorage()._selectedRows = newValue} + } + /// Returns true if `selectedRows` has been explicitly set. + var hasSelectedRows: Bool {return _storage._selectedRows != nil} + /// Clears the value of `selectedRows`. Subsequent reads from it will return its default value. + mutating func clearSelectedRows() {_storage._selectedRows = nil} + + var lodTensor: PaddleMobile_Framework_Proto_VarType.LoDTensorDesc { + get {return _storage._lodTensor ?? PaddleMobile_Framework_Proto_VarType.LoDTensorDesc()} + set {_uniqueStorage()._lodTensor = newValue} + } + /// Returns true if `lodTensor` has been explicitly set. + var hasLodTensor: Bool {return _storage._lodTensor != nil} + /// Clears the value of `lodTensor`. Subsequent reads from it will return its default value. + mutating func clearLodTensor() {_storage._lodTensor = nil} + + var tensorArray: PaddleMobile_Framework_Proto_VarType.LoDTensorArrayDesc { + get {return _storage._tensorArray ?? PaddleMobile_Framework_Proto_VarType.LoDTensorArrayDesc()} + set {_uniqueStorage()._tensorArray = newValue} + } + /// Returns true if `tensorArray` has been explicitly set. + var hasTensorArray: Bool {return _storage._tensorArray != nil} + /// Clears the value of `tensorArray`. Subsequent reads from it will return its default value. + mutating func clearTensorArray() {_storage._tensorArray = nil} + + var reader: PaddleMobile_Framework_Proto_VarType.ReaderDesc { + get {return _storage._reader ?? PaddleMobile_Framework_Proto_VarType.ReaderDesc()} + set {_uniqueStorage()._reader = newValue} + } + /// Returns true if `reader` has been explicitly set. + var hasReader: Bool {return _storage._reader != nil} + /// Clears the value of `reader`. Subsequent reads from it will return its default value. + mutating func clearReader() {_storage._reader = nil} + + var channel: PaddleMobile_Framework_Proto_VarType.ChannelDesc { + get {return _storage._channel ?? PaddleMobile_Framework_Proto_VarType.ChannelDesc()} + set {_uniqueStorage()._channel = newValue} + } + /// Returns true if `channel` has been explicitly set. + var hasChannel: Bool {return _storage._channel != nil} + /// Clears the value of `channel`. Subsequent reads from it will return its default value. + mutating func clearChannel() {_storage._channel = nil} + + var tuple: PaddleMobile_Framework_Proto_VarType.Tuple { + get {return _storage._tuple ?? PaddleMobile_Framework_Proto_VarType.Tuple()} + set {_uniqueStorage()._tuple = newValue} + } + /// Returns true if `tuple` has been explicitly set. + var hasTuple: Bool {return _storage._tuple != nil} + /// Clears the value of `tuple`. Subsequent reads from it will return its default value. + mutating func clearTuple() {_storage._tuple = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// Pod Types + case bool // = 0 + case int16 // = 1 + case int32 // = 2 + case int64 // = 3 + case fp16 // = 4 + case fp32 // = 5 + case fp64 // = 6 + + /// Other types that may need additional descriptions + case lodTensor // = 7 + case selectedRows // = 8 + case feedMinibatch // = 9 + case fetchList // = 10 + case stepScopes // = 11 + case lodRankTable // = 12 + case lodTensorArray // = 13 + case placeList // = 14 + case reader // = 15 + case channel // = 16 + + /// Any runtime decided variable type is raw + /// raw variables should manage their own allocations + /// in operators like nccl_op + case raw // = 17 + case tuple // = 18 + + init() { + self = .bool + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .bool + case 1: self = .int16 + case 2: self = .int32 + case 3: self = .int64 + case 4: self = .fp16 + case 5: self = .fp32 + case 6: self = .fp64 + case 7: self = .lodTensor + case 8: self = .selectedRows + case 9: self = .feedMinibatch + case 10: self = .fetchList + case 11: self = .stepScopes + case 12: self = .lodRankTable + case 13: self = .lodTensorArray + case 14: self = .placeList + case 15: self = .reader + case 16: self = .channel + case 17: self = .raw + case 18: self = .tuple + default: return nil + } + } + + var rawValue: Int { + switch self { + case .bool: return 0 + case .int16: return 1 + case .int32: return 2 + case .int64: return 3 + case .fp16: return 4 + case .fp32: return 5 + case .fp64: return 6 + case .lodTensor: return 7 + case .selectedRows: return 8 + case .feedMinibatch: return 9 + case .fetchList: return 10 + case .stepScopes: return 11 + case .lodRankTable: return 12 + case .lodTensorArray: return 13 + case .placeList: return 14 + case .reader: return 15 + case .channel: return 16 + case .raw: return 17 + case .tuple: return 18 + } + } + + } + + struct TensorDesc { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Should only be PODType. Is enforced in C++ + var dataType: PaddleMobile_Framework_Proto_VarType.TypeEnum { + get {return _dataType ?? .bool} + set {_dataType = newValue} + } + /// Returns true if `dataType` has been explicitly set. + var hasDataType: Bool {return self._dataType != nil} + /// Clears the value of `dataType`. Subsequent reads from it will return its default value. + mutating func clearDataType() {self._dataType = nil} + + /// [UNK, 640, 480] is saved as [-1, 640, 480] + var dims: [Int64] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _dataType: PaddleMobile_Framework_Proto_VarType.TypeEnum? = nil + } + + struct LoDTensorDesc { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var tensor: PaddleMobile_Framework_Proto_VarType.TensorDesc { + get {return _storage._tensor ?? PaddleMobile_Framework_Proto_VarType.TensorDesc()} + set {_uniqueStorage()._tensor = newValue} + } + /// Returns true if `tensor` has been explicitly set. + var hasTensor: Bool {return _storage._tensor != nil} + /// Clears the value of `tensor`. Subsequent reads from it will return its default value. + mutating func clearTensor() {_storage._tensor = nil} + + var lodLevel: Int32 { + get {return _storage._lodLevel ?? 0} + set {_uniqueStorage()._lodLevel = newValue} + } + /// Returns true if `lodLevel` has been explicitly set. + var hasLodLevel: Bool {return _storage._lodLevel != nil} + /// Clears the value of `lodLevel`. Subsequent reads from it will return its default value. + mutating func clearLodLevel() {_storage._lodLevel = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance + } + + struct LoDTensorArrayDesc { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var tensor: PaddleMobile_Framework_Proto_VarType.TensorDesc { + get {return _storage._tensor ?? PaddleMobile_Framework_Proto_VarType.TensorDesc()} + set {_uniqueStorage()._tensor = newValue} + } + /// Returns true if `tensor` has been explicitly set. + var hasTensor: Bool {return _storage._tensor != nil} + /// Clears the value of `tensor`. Subsequent reads from it will return its default value. + mutating func clearTensor() {_storage._tensor = nil} + + var lodLevel: Int32 { + get {return _storage._lodLevel ?? 0} + set {_uniqueStorage()._lodLevel = newValue} + } + /// Returns true if `lodLevel` has been explicitly set. + var hasLodLevel: Bool {return _storage._lodLevel != nil} + /// Clears the value of `lodLevel`. Subsequent reads from it will return its default value. + mutating func clearLodLevel() {_storage._lodLevel = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance + } + + struct ReaderDesc { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var lodTensor: [PaddleMobile_Framework_Proto_VarType.LoDTensorDesc] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + struct ChannelDesc { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var dataType: PaddleMobile_Framework_Proto_VarType.TypeEnum { + get {return _dataType ?? .bool} + set {_dataType = newValue} + } + /// Returns true if `dataType` has been explicitly set. + var hasDataType: Bool {return self._dataType != nil} + /// Clears the value of `dataType`. Subsequent reads from it will return its default value. + mutating func clearDataType() {self._dataType = nil} + + var capacity: Int64 { + get {return _capacity ?? 0} + set {_capacity = newValue} + } + /// Returns true if `capacity` has been explicitly set. + var hasCapacity: Bool {return self._capacity != nil} + /// Clears the value of `capacity`. Subsequent reads from it will return its default value. + mutating func clearCapacity() {self._capacity = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _dataType: PaddleMobile_Framework_Proto_VarType.TypeEnum? = nil + fileprivate var _capacity: Int64? = nil + } + + struct Tuple { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var elementType: [PaddleMobile_Framework_Proto_VarType.TypeEnum] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct PaddleMobile_Framework_Proto_VarDesc { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String { + get {return _storage._name ?? String()} + set {_uniqueStorage()._name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return _storage._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {_storage._name = nil} + + var type: PaddleMobile_Framework_Proto_VarType { + get {return _storage._type ?? PaddleMobile_Framework_Proto_VarType()} + set {_uniqueStorage()._type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return _storage._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {_storage._type = nil} + + var persistable: Bool { + get {return _storage._persistable ?? false} + set {_uniqueStorage()._persistable = newValue} + } + /// Returns true if `persistable` has been explicitly set. + var hasPersistable: Bool {return _storage._persistable != nil} + /// Clears the value of `persistable`. Subsequent reads from it will return its default value. + mutating func clearPersistable() {_storage._persistable = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct PaddleMobile_Framework_Proto_BlockDesc { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var idx: Int32 { + get {return _idx ?? 0} + set {_idx = newValue} + } + /// Returns true if `idx` has been explicitly set. + var hasIdx: Bool {return self._idx != nil} + /// Clears the value of `idx`. Subsequent reads from it will return its default value. + mutating func clearIdx() {self._idx = nil} + + var parentIdx: Int32 { + get {return _parentIdx ?? 0} + set {_parentIdx = newValue} + } + /// Returns true if `parentIdx` has been explicitly set. + var hasParentIdx: Bool {return self._parentIdx != nil} + /// Clears the value of `parentIdx`. Subsequent reads from it will return its default value. + mutating func clearParentIdx() {self._parentIdx = nil} + + var vars: [PaddleMobile_Framework_Proto_VarDesc] = [] + + var ops: [PaddleMobile_Framework_Proto_OpDesc] = [] + + var forwardBlockIdx: Int32 { + get {return _forwardBlockIdx ?? -1} + set {_forwardBlockIdx = newValue} + } + /// Returns true if `forwardBlockIdx` has been explicitly set. + var hasForwardBlockIdx: Bool {return self._forwardBlockIdx != nil} + /// Clears the value of `forwardBlockIdx`. Subsequent reads from it will return its default value. + mutating func clearForwardBlockIdx() {self._forwardBlockIdx = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _idx: Int32? = nil + fileprivate var _parentIdx: Int32? = nil + fileprivate var _forwardBlockIdx: Int32? = nil +} + +/// Please refer to +/// https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/program.md +/// for more details. +/// TODO(panyx0718): A model can have multiple programs. Need a +/// way to distinguish them. Maybe ID or name? +struct PaddleMobile_Framework_Proto_ProgramDesc { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var blocks: [PaddleMobile_Framework_Proto_BlockDesc] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "paddle_mobile.framework.proto" + +extension PaddleMobile_Framework_Proto_AttrType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "INT"), + 1: .same(proto: "FLOAT"), + 2: .same(proto: "STRING"), + 3: .same(proto: "INTS"), + 4: .same(proto: "FLOATS"), + 5: .same(proto: "STRINGS"), + 6: .same(proto: "BOOLEAN"), + 7: .same(proto: "BOOLEANS"), + 8: .same(proto: "BLOCK"), + 9: .same(proto: "LONG"), + ] +} + +extension PaddleMobile_Framework_Proto_OpDesc: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".OpDesc" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 3: .same(proto: "type"), + 1: .same(proto: "inputs"), + 2: .same(proto: "outputs"), + 4: .same(proto: "attrs"), + 5: .standard(proto: "is_target"), + ] + + public var isInitialized: Bool { + if self._type == nil {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.inputs) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.outputs) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.attrs) {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.inputs) + case 2: try decoder.decodeRepeatedMessageField(value: &self.outputs) + case 3: try decoder.decodeSingularStringField(value: &self._type) + case 4: try decoder.decodeRepeatedMessageField(value: &self.attrs) + case 5: try decoder.decodeSingularBoolField(value: &self._isTarget) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.inputs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.inputs, fieldNumber: 1) + } + if !self.outputs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.outputs, fieldNumber: 2) + } + if let v = self._type { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if !self.attrs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.attrs, fieldNumber: 4) + } + if let v = self._isTarget { + try visitor.visitSingularBoolField(value: v, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_OpDesc) -> Bool { + if self._type != other._type {return false} + if self.inputs != other.inputs {return false} + if self.outputs != other.outputs {return false} + if self.attrs != other.attrs {return false} + if self._isTarget != other._isTarget {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_OpDesc.Attr: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_OpDesc.protoMessageName + ".Attr" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "type"), + 3: .same(proto: "i"), + 4: .same(proto: "f"), + 5: .same(proto: "s"), + 6: .same(proto: "ints"), + 7: .same(proto: "floats"), + 8: .same(proto: "strings"), + 10: .same(proto: "b"), + 11: .same(proto: "bools"), + 12: .standard(proto: "block_idx"), + 13: .same(proto: "l"), + ] + + public var isInitialized: Bool { + if self._name == nil {return false} + if self._type == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._name) + case 2: try decoder.decodeSingularEnumField(value: &self._type) + case 3: try decoder.decodeSingularInt32Field(value: &self._i) + case 4: try decoder.decodeSingularFloatField(value: &self._f) + case 5: try decoder.decodeSingularStringField(value: &self._s) + case 6: try decoder.decodeRepeatedInt32Field(value: &self.ints) + case 7: try decoder.decodeRepeatedFloatField(value: &self.floats) + case 8: try decoder.decodeRepeatedStringField(value: &self.strings) + case 10: try decoder.decodeSingularBoolField(value: &self._b) + case 11: try decoder.decodeRepeatedBoolField(value: &self.bools) + case 12: try decoder.decodeSingularInt32Field(value: &self._blockIdx) + case 13: try decoder.decodeSingularInt64Field(value: &self._l) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + if let v = self._i { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) + } + if let v = self._f { + try visitor.visitSingularFloatField(value: v, fieldNumber: 4) + } + if let v = self._s { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } + if !self.ints.isEmpty { + try visitor.visitRepeatedInt32Field(value: self.ints, fieldNumber: 6) + } + if !self.floats.isEmpty { + try visitor.visitRepeatedFloatField(value: self.floats, fieldNumber: 7) + } + if !self.strings.isEmpty { + try visitor.visitRepeatedStringField(value: self.strings, fieldNumber: 8) + } + if let v = self._b { + try visitor.visitSingularBoolField(value: v, fieldNumber: 10) + } + if !self.bools.isEmpty { + try visitor.visitRepeatedBoolField(value: self.bools, fieldNumber: 11) + } + if let v = self._blockIdx { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 12) + } + if let v = self._l { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 13) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_OpDesc.Attr) -> Bool { + if self._name != other._name {return false} + if self._type != other._type {return false} + if self._i != other._i {return false} + if self._f != other._f {return false} + if self._s != other._s {return false} + if self.ints != other.ints {return false} + if self.floats != other.floats {return false} + if self.strings != other.strings {return false} + if self._b != other._b {return false} + if self.bools != other.bools {return false} + if self._blockIdx != other._blockIdx {return false} + if self._l != other._l {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_OpDesc.Var: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_OpDesc.protoMessageName + ".Var" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "parameter"), + 2: .same(proto: "arguments"), + ] + + public var isInitialized: Bool { + if self._parameter == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._parameter) + case 2: try decoder.decodeRepeatedStringField(value: &self.arguments) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._parameter { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if !self.arguments.isEmpty { + try visitor.visitRepeatedStringField(value: self.arguments, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_OpDesc.Var) -> Bool { + if self._parameter != other._parameter {return false} + if self.arguments != other.arguments {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_OpProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".OpProto" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "inputs"), + 3: .same(proto: "outputs"), + 4: .same(proto: "attrs"), + 5: .same(proto: "comment"), + ] + + public var isInitialized: Bool { + if self._type == nil {return false} + if self._comment == nil {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.inputs) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.outputs) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.attrs) {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._type) + case 2: try decoder.decodeRepeatedMessageField(value: &self.inputs) + case 3: try decoder.decodeRepeatedMessageField(value: &self.outputs) + case 4: try decoder.decodeRepeatedMessageField(value: &self.attrs) + case 5: try decoder.decodeSingularStringField(value: &self._comment) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._type { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if !self.inputs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.inputs, fieldNumber: 2) + } + if !self.outputs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.outputs, fieldNumber: 3) + } + if !self.attrs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.attrs, fieldNumber: 4) + } + if let v = self._comment { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_OpProto) -> Bool { + if self._type != other._type {return false} + if self.inputs != other.inputs {return false} + if self.outputs != other.outputs {return false} + if self.attrs != other.attrs {return false} + if self._comment != other._comment {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_OpProto.Var: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_OpProto.protoMessageName + ".Var" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "comment"), + 3: .same(proto: "duplicable"), + 4: .same(proto: "intermediate"), + 5: .same(proto: "dispensable"), + ] + + public var isInitialized: Bool { + if self._name == nil {return false} + if self._comment == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._name) + case 2: try decoder.decodeSingularStringField(value: &self._comment) + case 3: try decoder.decodeSingularBoolField(value: &self._duplicable) + case 4: try decoder.decodeSingularBoolField(value: &self._intermediate) + case 5: try decoder.decodeSingularBoolField(value: &self._dispensable) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._comment { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._duplicable { + try visitor.visitSingularBoolField(value: v, fieldNumber: 3) + } + if let v = self._intermediate { + try visitor.visitSingularBoolField(value: v, fieldNumber: 4) + } + if let v = self._dispensable { + try visitor.visitSingularBoolField(value: v, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_OpProto.Var) -> Bool { + if self._name != other._name {return false} + if self._comment != other._comment {return false} + if self._duplicable != other._duplicable {return false} + if self._intermediate != other._intermediate {return false} + if self._dispensable != other._dispensable {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_OpProto.Attr: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_OpProto.protoMessageName + ".Attr" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "type"), + 3: .same(proto: "comment"), + 4: .same(proto: "generated"), + ] + + public var isInitialized: Bool { + if self._name == nil {return false} + if self._type == nil {return false} + if self._comment == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self._name) + case 2: try decoder.decodeSingularEnumField(value: &self._type) + case 3: try decoder.decodeSingularStringField(value: &self._comment) + case 4: try decoder.decodeSingularBoolField(value: &self._generated) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + if let v = self._comment { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._generated { + try visitor.visitSingularBoolField(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_OpProto.Attr) -> Bool { + if self._name != other._name {return false} + if self._type != other._type {return false} + if self._comment != other._comment {return false} + if self._generated != other._generated {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_VarType: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".VarType" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .standard(proto: "selected_rows"), + 3: .standard(proto: "lod_tensor"), + 4: .standard(proto: "tensor_array"), + 5: .same(proto: "reader"), + 6: .same(proto: "channel"), + 7: .same(proto: "tuple"), + ] + + fileprivate class _StorageClass { + var _type: PaddleMobile_Framework_Proto_VarType.TypeEnum? = nil + var _selectedRows: PaddleMobile_Framework_Proto_VarType.TensorDesc? = nil + var _lodTensor: PaddleMobile_Framework_Proto_VarType.LoDTensorDesc? = nil + var _tensorArray: PaddleMobile_Framework_Proto_VarType.LoDTensorArrayDesc? = nil + var _reader: PaddleMobile_Framework_Proto_VarType.ReaderDesc? = nil + var _channel: PaddleMobile_Framework_Proto_VarType.ChannelDesc? = nil + var _tuple: PaddleMobile_Framework_Proto_VarType.Tuple? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _type = source._type + _selectedRows = source._selectedRows + _lodTensor = source._lodTensor + _tensorArray = source._tensorArray + _reader = source._reader + _channel = source._channel + _tuple = source._tuple + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + public var isInitialized: Bool { + return withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if _storage._type == nil {return false} + if let v = _storage._selectedRows, !v.isInitialized {return false} + if let v = _storage._lodTensor, !v.isInitialized {return false} + if let v = _storage._tensorArray, !v.isInitialized {return false} + if let v = _storage._reader, !v.isInitialized {return false} + if let v = _storage._channel, !v.isInitialized {return false} + return true + } + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &_storage._type) + case 2: try decoder.decodeSingularMessageField(value: &_storage._selectedRows) + case 3: try decoder.decodeSingularMessageField(value: &_storage._lodTensor) + case 4: try decoder.decodeSingularMessageField(value: &_storage._tensorArray) + case 5: try decoder.decodeSingularMessageField(value: &_storage._reader) + case 6: try decoder.decodeSingularMessageField(value: &_storage._channel) + case 7: try decoder.decodeSingularMessageField(value: &_storage._tuple) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if let v = _storage._selectedRows { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if let v = _storage._lodTensor { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if let v = _storage._tensorArray { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if let v = _storage._reader { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if let v = _storage._channel { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } + if let v = _storage._tuple { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_VarType) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._type != other_storage._type {return false} + if _storage._selectedRows != other_storage._selectedRows {return false} + if _storage._lodTensor != other_storage._lodTensor {return false} + if _storage._tensorArray != other_storage._tensorArray {return false} + if _storage._reader != other_storage._reader {return false} + if _storage._channel != other_storage._channel {return false} + if _storage._tuple != other_storage._tuple {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_VarType.TypeEnum: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "BOOL"), + 1: .same(proto: "INT16"), + 2: .same(proto: "INT32"), + 3: .same(proto: "INT64"), + 4: .same(proto: "FP16"), + 5: .same(proto: "FP32"), + 6: .same(proto: "FP64"), + 7: .same(proto: "LOD_TENSOR"), + 8: .same(proto: "SELECTED_ROWS"), + 9: .same(proto: "FEED_MINIBATCH"), + 10: .same(proto: "FETCH_LIST"), + 11: .same(proto: "STEP_SCOPES"), + 12: .same(proto: "LOD_RANK_TABLE"), + 13: .same(proto: "LOD_TENSOR_ARRAY"), + 14: .same(proto: "PLACE_LIST"), + 15: .same(proto: "READER"), + 16: .same(proto: "CHANNEL"), + 17: .same(proto: "RAW"), + 18: .same(proto: "TUPLE"), + ] +} + +extension PaddleMobile_Framework_Proto_VarType.TensorDesc: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_VarType.protoMessageName + ".TensorDesc" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "data_type"), + 2: .same(proto: "dims"), + ] + + public var isInitialized: Bool { + if self._dataType == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._dataType) + case 2: try decoder.decodeRepeatedInt64Field(value: &self.dims) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._dataType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if !self.dims.isEmpty { + try visitor.visitRepeatedInt64Field(value: self.dims, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_VarType.TensorDesc) -> Bool { + if self._dataType != other._dataType {return false} + if self.dims != other.dims {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_VarType.LoDTensorDesc: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_VarType.protoMessageName + ".LoDTensorDesc" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "tensor"), + 2: .standard(proto: "lod_level"), + ] + + fileprivate class _StorageClass { + var _tensor: PaddleMobile_Framework_Proto_VarType.TensorDesc? = nil + var _lodLevel: Int32? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _tensor = source._tensor + _lodLevel = source._lodLevel + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + public var isInitialized: Bool { + return withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if _storage._tensor == nil {return false} + if let v = _storage._tensor, !v.isInitialized {return false} + return true + } + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._tensor) + case 2: try decoder.decodeSingularInt32Field(value: &_storage._lodLevel) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._tensor { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._lodLevel { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_VarType.LoDTensorDesc) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._tensor != other_storage._tensor {return false} + if _storage._lodLevel != other_storage._lodLevel {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_VarType.LoDTensorArrayDesc: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_VarType.protoMessageName + ".LoDTensorArrayDesc" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "tensor"), + 2: .standard(proto: "lod_level"), + ] + + fileprivate class _StorageClass { + var _tensor: PaddleMobile_Framework_Proto_VarType.TensorDesc? = nil + var _lodLevel: Int32? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _tensor = source._tensor + _lodLevel = source._lodLevel + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + public var isInitialized: Bool { + return withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if _storage._tensor == nil {return false} + if let v = _storage._tensor, !v.isInitialized {return false} + return true + } + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._tensor) + case 2: try decoder.decodeSingularInt32Field(value: &_storage._lodLevel) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._tensor { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._lodLevel { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_VarType.LoDTensorArrayDesc) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._tensor != other_storage._tensor {return false} + if _storage._lodLevel != other_storage._lodLevel {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_VarType.ReaderDesc: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_VarType.protoMessageName + ".ReaderDesc" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "lod_tensor"), + ] + + public var isInitialized: Bool { + if !SwiftProtobuf.Internal.areAllInitialized(self.lodTensor) {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.lodTensor) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.lodTensor.isEmpty { + try visitor.visitRepeatedMessageField(value: self.lodTensor, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_VarType.ReaderDesc) -> Bool { + if self.lodTensor != other.lodTensor {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_VarType.ChannelDesc: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_VarType.protoMessageName + ".ChannelDesc" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "data_type"), + 2: .same(proto: "capacity"), + ] + + public var isInitialized: Bool { + if self._dataType == nil {return false} + if self._capacity == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self._dataType) + case 2: try decoder.decodeSingularInt64Field(value: &self._capacity) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._dataType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if let v = self._capacity { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_VarType.ChannelDesc) -> Bool { + if self._dataType != other._dataType {return false} + if self._capacity != other._capacity {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_VarType.Tuple: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = PaddleMobile_Framework_Proto_VarType.protoMessageName + ".Tuple" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "element_type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedEnumField(value: &self.elementType) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.elementType.isEmpty { + try visitor.visitRepeatedEnumField(value: self.elementType, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_VarType.Tuple) -> Bool { + if self.elementType != other.elementType {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_VarDesc: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".VarDesc" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "type"), + 3: .same(proto: "persistable"), + ] + + fileprivate class _StorageClass { + var _name: String? = nil + var _type: PaddleMobile_Framework_Proto_VarType? = nil + var _persistable: Bool? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _name = source._name + _type = source._type + _persistable = source._persistable + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + public var isInitialized: Bool { + return withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if _storage._name == nil {return false} + if _storage._type == nil {return false} + if let v = _storage._type, !v.isInitialized {return false} + return true + } + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._name) + case 2: try decoder.decodeSingularMessageField(value: &_storage._type) + case 3: try decoder.decodeSingularBoolField(value: &_storage._persistable) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = _storage._type { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if let v = _storage._persistable { + try visitor.visitSingularBoolField(value: v, fieldNumber: 3) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_VarDesc) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._name != other_storage._name {return false} + if _storage._type != other_storage._type {return false} + if _storage._persistable != other_storage._persistable {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_BlockDesc: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BlockDesc" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "idx"), + 2: .standard(proto: "parent_idx"), + 3: .same(proto: "vars"), + 4: .same(proto: "ops"), + 5: .standard(proto: "forward_block_idx"), + ] + + public var isInitialized: Bool { + if self._idx == nil {return false} + if self._parentIdx == nil {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.vars) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.ops) {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt32Field(value: &self._idx) + case 2: try decoder.decodeSingularInt32Field(value: &self._parentIdx) + case 3: try decoder.decodeRepeatedMessageField(value: &self.vars) + case 4: try decoder.decodeRepeatedMessageField(value: &self.ops) + case 5: try decoder.decodeSingularInt32Field(value: &self._forwardBlockIdx) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._idx { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } + if let v = self._parentIdx { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } + if !self.vars.isEmpty { + try visitor.visitRepeatedMessageField(value: self.vars, fieldNumber: 3) + } + if !self.ops.isEmpty { + try visitor.visitRepeatedMessageField(value: self.ops, fieldNumber: 4) + } + if let v = self._forwardBlockIdx { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_BlockDesc) -> Bool { + if self._idx != other._idx {return false} + if self._parentIdx != other._parentIdx {return false} + if self.vars != other.vars {return false} + if self.ops != other.ops {return false} + if self._forwardBlockIdx != other._forwardBlockIdx {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension PaddleMobile_Framework_Proto_ProgramDesc: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ProgramDesc" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "blocks"), + ] + + public var isInitialized: Bool { + if !SwiftProtobuf.Internal.areAllInitialized(self.blocks) {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.blocks) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.blocks.isEmpty { + try visitor.visitRepeatedMessageField(value: self.blocks, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: PaddleMobile_Framework_Proto_ProgramDesc) -> Bool { + if self.blocks != other.blocks {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} diff --git a/metal/paddle-mobile/paddle-mobile/framework/Dim.swift b/metal/paddle-mobile/paddle-mobile/framework/Dim.swift new file mode 100644 index 0000000000000000000000000000000000000000..fa96f23b74832b0244535ddf28b221d5fdbb9bc7 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/framework/Dim.swift @@ -0,0 +1,46 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +struct Dim { + init(inDim: [Int]) { + dims = inDim + } + + mutating func swapeDimAt(index1: Int, index2: Int) { + dims.swapAt(index1, index2) + } + + func cout() -> Int { + return dims.count + } + + func numel() -> Int { + return dims.reduce(1) { $0 * $1 } + } + + static func ==(left: Dim, right: Dim) -> Bool { + return left.dims == right.dims; + } + + subscript(index: Int) -> Int { + return dims[index]; + } + + private var dims: [Int] + private init(){ + fatalError() + } +} diff --git a/metal/paddle-mobile/paddle-mobile/framework/Tensor.swift b/metal/paddle-mobile/paddle-mobile/framework/Tensor.swift new file mode 100644 index 0000000000000000000000000000000000000000..7d00e9b8687674cf955910f3d208fb3140a7032f --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/framework/Tensor.swift @@ -0,0 +1,36 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ + +import Foundation + +class Tensor { + var dim: Dim { + return paraData.dim + } + let paraData: ParamData

+ init(inDimArray: [Int], inData: ParamData

) { + paraData = inData + } + init(inData: ParamData

) { + paraData = inData + } + func numel() -> Int { + return dim.numel() + } + + func dataLayout() -> DataLayout { + return paraData.layout + } + +} diff --git a/metal/paddle-mobile/paddle-mobile/paddle_mobile.h b/metal/paddle-mobile/paddle-mobile/paddle_mobile.h new file mode 100644 index 0000000000000000000000000000000000000000..017e964fbfcb2f636d5ce5702ecd3d83be6aa617 --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile/paddle_mobile.h @@ -0,0 +1,19 @@ +// +// paddle_mobile.h +// paddle-mobile +// +// Created by liuRuiLong on 2018/6/25. +// Copyright © 2018年 orange. All rights reserved. +// + +#import + +//! Project version number for paddle_mobile. +FOUNDATION_EXPORT double paddle_mobileVersionNumber; + +//! Project version string for paddle_mobile. +FOUNDATION_EXPORT const unsigned char paddle_mobileVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +