Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
5a68593c
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5a68593c
编写于
1月 29, 2019
作者:
qnqinan
提交者:
GitHub
1月 29, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into develop
上级
b09e7b98
4f06fd5c
变更
49
隐藏空白更改
内联
并排
Showing
49 changed file
with
2298 addition
and
114 deletion
+2298
-114
metal/MobileNetDemo/MobileNetDemo.xcodeproj/project.pbxproj
metal/MobileNetDemo/MobileNetDemo.xcodeproj/project.pbxproj
+6
-4
metal/Podfile
metal/Podfile
+8
-4
metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj
...-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj
+2
-2
metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.pbxproj
...it-test/paddle-mobile-unit-test.xcodeproj/project.pbxproj
+2
-2
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
+29
-21
metal/paddle-mobile/paddle-mobile/Src/Framework/Loader.swift
metal/paddle-mobile/paddle-mobile/Src/Framework/Loader.swift
+9
-5
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/OpCreator.swift
...e-mobile/paddle-mobile/Src/Operators/Base/OpCreator.swift
+2
-2
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/OpParam.swift
...dle-mobile/paddle-mobile/Src/Operators/Base/OpParam.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/Operator.swift
...le-mobile/paddle-mobile/Src/Operators/Base/Operator.swift
+5
-5
metal/paddle-mobile/paddle-mobile/Src/Operators/BatchNormOp.swift
...ddle-mobile/paddle-mobile/Src/Operators/BatchNormOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/BilinearInterpOp.swift
...mobile/paddle-mobile/Src/Operators/BilinearInterpOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/BoxcoderOp.swift
...addle-mobile/paddle-mobile/Src/Operators/BoxcoderOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConcatOp.swift
.../paddle-mobile/paddle-mobile/Src/Operators/ConcatOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddAddPreluOp.swift
...obile/paddle-mobile/Src/Operators/ConvAddAddPreluOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddBatchNormReluOp.swift
.../paddle-mobile/Src/Operators/ConvAddBatchNormReluOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddOp.swift
...paddle-mobile/paddle-mobile/Src/Operators/ConvAddOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddPreluOp.swift
...e-mobile/paddle-mobile/Src/Operators/ConvAddPreluOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvBNReluOp.swift
...dle-mobile/paddle-mobile/Src/Operators/ConvBNReluOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvOp.swift
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvTransposeOp.swift
...-mobile/paddle-mobile/Src/Operators/ConvTransposeOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ElementwiseAddOp.swift
...mobile/paddle-mobile/Src/Operators/ElementwiseAddOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ElementwiseAddPreluOp.swift
...e/paddle-mobile/Src/Operators/ElementwiseAddPreluOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/FeedOp.swift
metal/paddle-mobile/paddle-mobile/Src/Operators/FeedOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/FetchOp.swift
...l/paddle-mobile/paddle-mobile/Src/Operators/FetchOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/FlattenOp.swift
...paddle-mobile/paddle-mobile/Src/Operators/FlattenOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/metal/BufferToTexture.metal
...-mobile/Src/Operators/Kernels/metal/BufferToTexture.metal
+36
-0
metal/paddle-mobile/paddle-mobile/Src/Operators/MulticlassNMSOp.swift
...-mobile/paddle-mobile/Src/Operators/MulticlassNMSOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/PoolOp.swift
metal/paddle-mobile/paddle-mobile/Src/Operators/PoolOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/PreluOp.swift
...l/paddle-mobile/paddle-mobile/Src/Operators/PreluOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/PriorBoxOp.swift
...addle-mobile/paddle-mobile/Src/Operators/PriorBoxOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ReluOp.swift
metal/paddle-mobile/paddle-mobile/Src/Operators/ReluOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ReshapeOp.swift
...paddle-mobile/paddle-mobile/Src/Operators/ReshapeOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ResizeBilinearOp.swift
...mobile/paddle-mobile/Src/Operators/ResizeBilinearOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/ShapeOp.swift
...l/paddle-mobile/paddle-mobile/Src/Operators/ShapeOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/SoftmaxOp.swift
...paddle-mobile/paddle-mobile/Src/Operators/SoftmaxOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/SplitOp.swift
...l/paddle-mobile/paddle-mobile/Src/Operators/SplitOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Operators/TransposeOp.swift
...ddle-mobile/paddle-mobile/Src/Operators/TransposeOp.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Src/Program/Attribute.swift
...l/paddle-mobile/paddle-mobile/Src/Program/Attribute.swift
+28
-5
metal/paddle-mobile/paddle-mobile/Src/Program/Framework.pbobjc.h
...addle-mobile/paddle-mobile/Src/Program/Framework.pbobjc.h
+599
-0
metal/paddle-mobile/paddle-mobile/Src/Program/Framework.pbobjc.m
...addle-mobile/paddle-mobile/Src/Program/Framework.pbobjc.m
+1417
-0
metal/paddle-mobile/paddle-mobile/Src/Program/PMBlockDesc.swift
...paddle-mobile/paddle-mobile/Src/Program/PMBlockDesc.swift
+12
-12
metal/paddle-mobile/paddle-mobile/Src/Program/PMOpDesc.swift
metal/paddle-mobile/paddle-mobile/Src/Program/PMOpDesc.swift
+81
-0
metal/paddle-mobile/paddle-mobile/Src/Program/PMProgramDesc.swift
...ddle-mobile/paddle-mobile/Src/Program/PMProgramDesc.swift
+6
-6
metal/paddle-mobile/paddle-mobile/Src/Program/PMVarDesc.swift
...l/paddle-mobile/paddle-mobile/Src/Program/PMVarDesc.swift
+5
-5
metal/paddle-mobile/paddle-mobile/Src/Program/Program.swift
metal/paddle-mobile/paddle-mobile/Src/Program/Program.swift
+3
-3
metal/paddle-mobile/paddle-mobile/Src/Program/ProgramOptimize.swift
...le-mobile/paddle-mobile/Src/Program/ProgramOptimize.swift
+6
-6
metal/paddle-mobile/paddle-mobile/Src/Program/TensorDesc.swift
.../paddle-mobile/paddle-mobile/Src/Program/TensorDesc.swift
+13
-3
metal/paddle-mobile/paddle-mobile/Src/Program/framework.pb.swift
...addle-mobile/paddle-mobile/Src/Program/framework.pb.swift
+0
-1
metal/paddle-mobile/paddle-mobile/paddle_mobile.h
metal/paddle-mobile/paddle-mobile/paddle_mobile.h
+1
-0
未找到文件。
metal/MobileNetDemo/MobileNetDemo.xcodeproj/project.pbxproj
浏览文件 @
5a68593c
...
...
@@ -243,13 +243,13 @@
);
inputPaths
=
(
"${SRCROOT}/../Pods/Target Support Files/Pods-MobileNetDemo/Pods-MobileNetDemo-frameworks.sh"
,
"${BUILT_PRODUCTS_DIR}/
SwiftProtobuf/Swift
Protobuf.framework"
,
"${BUILT_PRODUCTS_DIR}/
Protobuf/
Protobuf.framework"
,
);
name
=
"[CP] Embed Pods Frameworks"
;
outputFileListPaths
=
(
);
outputPaths
=
(
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/
Swift
Protobuf.framework"
,
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework"
,
);
runOnlyForDeploymentPostprocessing
=
0
;
shellPath
=
/bin/sh
;
...
...
@@ -436,7 +436,7 @@
baseConfigurationReference
=
4FE67FF667A24FCB0134F627
/* Pods-MobileNetDemo.debug.xcconfig */
;
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
CODE_SIGN_STYLE
=
Automatic
;
CODE_SIGN_STYLE
=
Manual
;
DEVELOPMENT_TEAM
=
A798K58VVL
;
INFOPLIST_FILE
=
MobileNetDemo/Info.plist
;
IPHONEOS_DEPLOYMENT_TARGET
=
9.0
;
...
...
@@ -446,6 +446,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER
=
Ray.MobileNetDemo
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
PROVISIONING_PROFILE_SPECIFIER
=
ForAllDev
;
SWIFT_VERSION
=
4.0
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
};
...
...
@@ -456,7 +457,7 @@
baseConfigurationReference
=
E57059FE3629E3A8DE6C7ECF
/* Pods-MobileNetDemo.release.xcconfig */
;
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
CODE_SIGN_STYLE
=
Automatic
;
CODE_SIGN_STYLE
=
Manual
;
DEVELOPMENT_TEAM
=
A798K58VVL
;
INFOPLIST_FILE
=
MobileNetDemo/Info.plist
;
IPHONEOS_DEPLOYMENT_TARGET
=
9.0
;
...
...
@@ -466,6 +467,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER
=
Ray.MobileNetDemo
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
PROVISIONING_PROFILE_SPECIFIER
=
ForAllDev
;
SWIFT_VERSION
=
4.0
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
};
...
...
metal/Podfile
浏览文件 @
5a68593c
...
...
@@ -5,21 +5,25 @@ workspace 'paddle-mobile.xcworkspace'
target
'paddle-mobile-demo'
do
project
'paddle-mobile-demo/paddle-mobile-demo.xcodeproj'
pod
'SwiftProtobuf'
,
'~> 1.0'
# pod 'SwiftProtobuf', '~> 1.0'
pod
'Protobuf'
,
'~> 3.0.0'
end
target
'paddle-mobile'
do
project
'paddle-mobile/paddle-mobile.xcodeproj'
pod
'SwiftProtobuf'
,
'~> 1.0'
# pod 'SwiftProtobuf', '~> 1.0'
pod
'Protobuf'
,
'~> 3.0.0'
end
target
'paddle-mobile-unit-test'
do
project
'paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj'
pod
'SwiftProtobuf'
,
'~> 1.0'
# pod 'SwiftProtobuf', '~> 1.0'
pod
'Protobuf'
,
'~> 3.0.0'
end
target
'MobileNetDemo'
do
project
'MobileNetDemo/MobileNetDemo.xcodeproj'
pod
'SwiftProtobuf'
,
'~> 1.0'
# pod 'SwiftProtobuf', '~> 1.0'
pod
'Protobuf'
,
'~> 3.0.0'
end
metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj
浏览文件 @
5a68593c
...
...
@@ -411,11 +411,11 @@
);
inputPaths
=
(
"${SRCROOT}/../Pods/Target Support Files/Pods-paddle-mobile-demo/Pods-paddle-mobile-demo-frameworks.sh"
,
"${BUILT_PRODUCTS_DIR}/
SwiftProtobuf/Swift
Protobuf.framework"
,
"${BUILT_PRODUCTS_DIR}/
Protobuf/
Protobuf.framework"
,
);
name
=
"[CP] Embed Pods Frameworks"
;
outputPaths
=
(
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/
Swift
Protobuf.framework"
,
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework"
,
);
runOnlyForDeploymentPostprocessing
=
0
;
shellPath
=
/bin/sh
;
...
...
metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.pbxproj
浏览文件 @
5a68593c
...
...
@@ -234,11 +234,11 @@
);
inputPaths
=
(
"${SRCROOT}/../Pods/Target Support Files/Pods-paddle-mobile-unit-test/Pods-paddle-mobile-unit-test-frameworks.sh"
,
"${BUILT_PRODUCTS_DIR}/
SwiftProtobuf/Swift
Protobuf.framework"
,
"${BUILT_PRODUCTS_DIR}/
Protobuf/
Protobuf.framework"
,
);
name
=
"[CP] Embed Pods Frameworks"
;
outputPaths
=
(
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/
Swift
Protobuf.framework"
,
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework"
,
);
runOnlyForDeploymentPostprocessing
=
0
;
shellPath
=
/bin/sh
;
...
...
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
浏览文件 @
5a68593c
...
...
@@ -7,6 +7,8 @@
objects
=
{
/* Begin PBXBuildFile section */
456BB7B421F5B356001474E2
/* Framework.pbobjc.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
456BB7B221F5B356001474E2
/* Framework.pbobjc.m */
;
settings
=
{
COMPILER_FLAGS
=
"-fno-objc-arc"
;
};
};
456BB7B521F5B356001474E2
/* Framework.pbobjc.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
456BB7B321F5B356001474E2
/* Framework.pbobjc.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
4AA1EA862146625E00D0F791
/* BilinearInterpOp.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EA852146625E00D0F791
/* BilinearInterpOp.swift */
;
};
4AA1EA88214662BD00D0F791
/* BilinearInterpKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EA87214662BD00D0F791
/* BilinearInterpKernel.swift */
;
};
4AA1EA8A2146631C00D0F791
/* BilinearInterp.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4AA1EA892146631C00D0F791
/* BilinearInterp.metal */
;
};
...
...
@@ -47,15 +49,14 @@
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
/* P
rogramDesc.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB220E11CC20081E9F8
/*
ProgramDesc.swift */
;
};
FC039BBC20E11CC20081E9F8
/*
VarDesc.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB320E11CC20081E9F8
/*
VarDesc.swift */
;
};
FC039BBB20E11CC20081E9F8
/* P
MProgramDesc.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB220E11CC20081E9F8
/* PM
ProgramDesc.swift */
;
};
FC039BBC20E11CC20081E9F8
/*
PMVarDesc.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB320E11CC20081E9F8
/* PM
VarDesc.swift */
;
};
FC039BBD20E11CC20081E9F8
/* Program.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB420E11CC20081E9F8
/* Program.swift */
;
};
FC039BBE20E11CC20081E9F8
/*
OpDesc.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB520E11CC20081E9F8
/*
OpDesc.swift */
;
};
FC039BBE20E11CC20081E9F8
/*
PMOpDesc.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB520E11CC20081E9F8
/* PM
OpDesc.swift */
;
};
FC039BBF20E11CC20081E9F8
/* Attribute.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB620E11CC20081E9F8
/* Attribute.swift */
;
};
FC039BC020E11CC20081E9F8
/*
BlockDesc.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB720E11CC20081E9F8
/*
BlockDesc.swift */
;
};
FC039BC020E11CC20081E9F8
/*
PMBlockDesc.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC039BB720E11CC20081E9F8
/* PM
BlockDesc.swift */
;
};
FC0E2DBA20EE3B8D009C1FAC
/* ReluKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC0E2DB920EE3B8D009C1FAC
/* ReluKernel.swift */
;
};
FC0E2DBC20EE45FE009C1FAC
/* ConvKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC0E2DBB20EE45FE009C1FAC
/* ConvKernel.swift */
;
};
FC0E2DBE20EE460D009C1FAC
/* BatchNormKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC0E2DBD20EE460D009C1FAC
/* BatchNormKernel.swift */
;
};
...
...
@@ -93,6 +94,7 @@
FCA67CD7213827AC00BD58AA
/* ConvAddBNReluKernel.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FCA67CD6213827AC00BD58AA
/* ConvAddBNReluKernel.metal */
;
};
FCA67CD92138287B00BD58AA
/* ConvBNReluKernel.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FCA67CD82138287B00BD58AA
/* ConvBNReluKernel.metal */
;
};
FCB40E5921E0DCAB0075EC91
/* FetchKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FCB40E5821E0DCAB0075EC91
/* FetchKernel.swift */
;
};
FCB91DC221FEEE990051C6B2
/* BufferToTexture.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FCB91DC121FEEE990051C6B2
/* BufferToTexture.metal */
;
};
FCBCCC572122F41300D94F7E
/* DwConvBNReluOp.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FCBCCC562122F41300D94F7E
/* DwConvBNReluOp.swift */
;
};
FCBCCC592122F42700D94F7E
/* ConvBNReluOp.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FCBCCC582122F42700D94F7E
/* ConvBNReluOp.swift */
;
};
FCBCCC5B2122F66F00D94F7E
/* ConvBNReluKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FCBCCC5A2122F66F00D94F7E
/* ConvBNReluKernel.swift */
;
};
...
...
@@ -137,6 +139,8 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
456BB7B221F5B356001474E2
/* Framework.pbobjc.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
Framework.pbobjc.m
;
sourceTree
=
"<group>"
;
};
456BB7B321F5B356001474E2
/* Framework.pbobjc.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
Framework.pbobjc.h
;
sourceTree
=
"<group>"
;
};
4AA1EA852146625E00D0F791
/* BilinearInterpOp.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BilinearInterpOp.swift
;
sourceTree
=
"<group>"
;
};
4AA1EA87214662BD00D0F791
/* BilinearInterpKernel.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BilinearInterpKernel.swift
;
sourceTree
=
"<group>"
;
};
4AA1EA892146631C00D0F791
/* BilinearInterp.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
BilinearInterp.metal
;
sourceTree
=
"<group>"
;
};
...
...
@@ -182,15 +186,14 @@
FC039BA620E11CBC0081E9F8
/* Operator.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Operator.swift
;
sourceTree
=
"<group>"
;
};
FC039BA720E11CBC0081E9F8
/* BatchNormOp.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BatchNormOp.swift
;
sourceTree
=
"<group>"
;
};
FC039BA820E11CBC0081E9F8
/* ReluOp.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ReluOp.swift
;
sourceTree
=
"<group>"
;
};
FC039BAF20E11CC20081E9F8
/* framework.pb.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
framework.pb.swift
;
sourceTree
=
"<group>"
;
};
FC039BB020E11CC20081E9F8
/* Scope.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Scope.swift
;
sourceTree
=
"<group>"
;
};
FC039BB120E11CC20081E9F8
/* TensorDesc.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TensorDesc.swift
;
sourceTree
=
"<group>"
;
};
FC039BB220E11CC20081E9F8
/* P
rogramDesc.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ProgramDesc.swift
;
sourceTree
=
"<group>"
;
};
FC039BB320E11CC20081E9F8
/*
VarDesc.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
VarDesc.swift
;
sourceTree
=
"<group>"
;
};
FC039BB220E11CC20081E9F8
/* P
MProgramDesc.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PM
ProgramDesc.swift
;
sourceTree
=
"<group>"
;
};
FC039BB320E11CC20081E9F8
/*
PMVarDesc.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PM
VarDesc.swift
;
sourceTree
=
"<group>"
;
};
FC039BB420E11CC20081E9F8
/* Program.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Program.swift
;
sourceTree
=
"<group>"
;
};
FC039BB520E11CC20081E9F8
/*
OpDesc.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
OpDesc.swift
;
sourceTree
=
"<group>"
;
};
FC039BB520E11CC20081E9F8
/*
PMOpDesc.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PM
OpDesc.swift
;
sourceTree
=
"<group>"
;
};
FC039BB620E11CC20081E9F8
/* Attribute.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Attribute.swift
;
sourceTree
=
"<group>"
;
};
FC039BB720E11CC20081E9F8
/*
BlockDesc.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BlockDesc.swift
;
sourceTree
=
"<group>"
;
};
FC039BB720E11CC20081E9F8
/*
PMBlockDesc.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PM
BlockDesc.swift
;
sourceTree
=
"<group>"
;
};
FC0E2DB920EE3B8D009C1FAC
/* ReluKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ReluKernel.swift
;
sourceTree
=
"<group>"
;
};
FC0E2DBB20EE45FE009C1FAC
/* ConvKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ConvKernel.swift
;
sourceTree
=
"<group>"
;
};
FC0E2DBD20EE460D009C1FAC
/* BatchNormKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BatchNormKernel.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -229,6 +232,7 @@
FCA67CD6213827AC00BD58AA
/* ConvAddBNReluKernel.metal */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.metal
;
path
=
ConvAddBNReluKernel.metal
;
sourceTree
=
"<group>"
;
};
FCA67CD82138287B00BD58AA
/* ConvBNReluKernel.metal */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.metal
;
path
=
ConvBNReluKernel.metal
;
sourceTree
=
"<group>"
;
};
FCB40E5821E0DCAB0075EC91
/* FetchKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
FetchKernel.swift
;
sourceTree
=
"<group>"
;
};
FCB91DC121FEEE990051C6B2
/* BufferToTexture.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
BufferToTexture.metal
;
sourceTree
=
"<group>"
;
};
FCBCCC562122F41300D94F7E
/* DwConvBNReluOp.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DwConvBNReluOp.swift
;
sourceTree
=
"<group>"
;
};
FCBCCC582122F42700D94F7E
/* ConvBNReluOp.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ConvBNReluOp.swift
;
sourceTree
=
"<group>"
;
};
FCBCCC5A2122F66F00D94F7E
/* ConvBNReluKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ConvBNReluKernel.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -403,15 +407,16 @@
FC039BAE20E11CC20081E9F8
/* Program */
=
{
isa
=
PBXGroup
;
children
=
(
FC039BAF20E11CC20081E9F8
/* framework.pb.swift */
,
456BB7B321F5B356001474E2
/* Framework.pbobjc.h */
,
456BB7B221F5B356001474E2
/* Framework.pbobjc.m */
,
FC039BB020E11CC20081E9F8
/* Scope.swift */
,
FC039BB120E11CC20081E9F8
/* TensorDesc.swift */
,
FC039BB220E11CC20081E9F8
/* ProgramDesc.swift */
,
FC039BB320E11CC20081E9F8
/* VarDesc.swift */
,
FC039BB220E11CC20081E9F8
/* P
MP
rogramDesc.swift */
,
FC039BB320E11CC20081E9F8
/*
PM
VarDesc.swift */
,
FC039BB420E11CC20081E9F8
/* Program.swift */
,
FC039BB520E11CC20081E9F8
/* OpDesc.swift */
,
FC039BB520E11CC20081E9F8
/*
PM
OpDesc.swift */
,
FC039BB620E11CC20081E9F8
/* Attribute.swift */
,
FC039BB720E11CC20081E9F8
/* BlockDesc.swift */
,
FC039BB720E11CC20081E9F8
/*
PM
BlockDesc.swift */
,
FC4CB74A20F12C30007C0C6D
/* ProgramOptimize.swift */
,
);
path
=
Program
;
...
...
@@ -496,6 +501,7 @@
FCEB6837212F00B100D2448E
/* metal */
=
{
isa
=
PBXGroup
;
children
=
(
FCB91DC121FEEE990051C6B2
/* BufferToTexture.metal */
,
4AF928812135673D005B6C3A
/* ConcatKernel.metal */
,
4AA1EA9D2148D6F900D0F791
/* ConcatKernel.inc.metal */
,
4AF9288321357BE3005B6C3A
/* Elementwise.metal */
,
...
...
@@ -545,6 +551,7 @@
isa
=
PBXHeadersBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
456BB7B521F5B356001474E2
/* Framework.pbobjc.h in Headers */
,
FC039B6F20E11C3C0081E9F8
/* paddle_mobile.h in Headers */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -582,7 +589,7 @@
TargetAttributes
=
{
FC039B6920E11C3C0081E9F8
=
{
CreatedOnToolsVersion
=
9.3.1
;
LastSwiftMigration
=
094
0
;
LastSwiftMigration
=
100
0
;
};
};
};
...
...
@@ -659,7 +666,7 @@
FCD04E7020F31B720007374F
/* ReshapeKernel.swift in Sources */
,
FCE3A1B12153E90F00C37CDE
/* ElementwiseAddPreluKernel.inc.metal in Sources */
,
FCD04E7220F343420007374F
/* ConvAddOp.swift in Sources */
,
FC039BBB20E11CC20081E9F8
/* ProgramDesc.swift in Sources */
,
FC039BBB20E11CC20081E9F8
/* P
MP
rogramDesc.swift in Sources */
,
FCE3A1AB2153DE8C00C37CDE
/* ConvAddAddPreluKernel.swift in Sources */
,
FC9D037920E229E4000F735A
/* OpParam.swift in Sources */
,
FC3602CC2108819F00FACB58
/* PaddleMobileUnitTest.swift in Sources */
,
...
...
@@ -670,6 +677,7 @@
FCA67CD52138272900BD58AA
/* ConvAddMetal.metal in Sources */
,
FCBCCC5B2122F66F00D94F7E
/* ConvBNReluKernel.swift in Sources */
,
4AA1EA8C2146640900D0F791
/* SplitOp.swift in Sources */
,
FCB91DC221FEEE990051C6B2
/* BufferToTexture.metal in Sources */
,
4AA1EAAC214F55C800D0F791
/* Softmax.inc.metal in Sources */
,
FC0E2DC020EE461F009C1FAC
/* ElementwiseAddKernel.swift in Sources */
,
4AF928772133F1DB005B6C3A
/* BoxCoder.metal in Sources */
,
...
...
@@ -684,7 +692,6 @@
FC1B16B320EC9A4F00678B91
/* Kernels.metal in Sources */
,
FC039BBA20E11CC20081E9F8
/* TensorDesc.swift in Sources */
,
FC039BA020E11CB20081E9F8
/* Dim.swift in Sources */
,
FC039BB820E11CC20081E9F8
/* framework.pb.swift in Sources */
,
FC039B9920E11C9A0081E9F8
/* Types.swift in Sources */
,
FC4CB74920F0B954007C0C6D
/* ConvKernel.metal in Sources */
,
FCA3A1632132A4AC00084FE5
/* ReshapeKernel.metal in Sources */
,
...
...
@@ -698,6 +705,7 @@
4AA1EAA2214912CD00D0F791
/* FlattenKernel.swift in Sources */
,
4AA1EA982146666500D0F791
/* FlattenOp.swift in Sources */
,
FC2BFCC221DF2F9100C262B2
/* GlobalConfig.swift in Sources */
,
456BB7B421F5B356001474E2
/* Framework.pbobjc.m in Sources */
,
FCBCCC652122FCD700D94F7E
/* TransposeOp.swift in Sources */
,
4AA1EAA6214B5F6800D0F791
/* Shape.metal in Sources */
,
FCD04E6E20F31B4B0007374F
/* ReshapeOp.swift in Sources */
,
...
...
@@ -711,7 +719,7 @@
FCE9D7B9214FAA4800B520C3
/* NMSFetchResultKernel.metal in Sources */
,
FC039BAC20E11CBC0081E9F8
/* BatchNormOp.swift in Sources */
,
FCBCCC6F2123097100D94F7E
/* MulticlassNMSOp.swift in Sources */
,
FC039BBC20E11CC20081E9F8
/* VarDesc.swift in Sources */
,
FC039BBC20E11CC20081E9F8
/*
PM
VarDesc.swift in Sources */
,
FC803BC5214CB8F00094B8E5
/* ConvAddPrelu.inc.metal in Sources */
,
4AF928822135673D005B6C3A
/* ConcatKernel.metal in Sources */
,
FCBCCC632122FCC000D94F7E
/* TransposeKernel.swift in Sources */
,
...
...
@@ -749,14 +757,14 @@
FCE3A1A92153DE5100C37CDE
/* ConvAddAddPreluOp.swift in Sources */
,
FC5163F620EF556E00636C28
/* Texture2DTo2DArrayKernel.swift in Sources */
,
FCE3A1AD2153E8BA00C37CDE
/* ElementwiseAddPreluOp.swift in Sources */
,
FC039BC020E11CC20081E9F8
/* BlockDesc.swift in Sources */
,
FC039BC020E11CC20081E9F8
/*
PM
BlockDesc.swift in Sources */
,
FC803BC3214CB79C0094B8E5
/* ConvAddPreluKernel.metal in Sources */
,
4AA1EA90214664CD00D0F791
/* Split.metal in Sources */
,
FCD04E6820F315020007374F
/* PoolKernel.swift in Sources */
,
FC0226582138F38D00F395E2
/* PoolKernel.metal in Sources */
,
FC039BAD20E11CBC0081E9F8
/* ReluOp.swift in Sources */
,
FCBCCC572122F41300D94F7E
/* DwConvBNReluOp.swift in Sources */
,
FC039BBE20E11CC20081E9F8
/* OpDesc.swift in Sources */
,
FC039BBE20E11CC20081E9F8
/*
PM
OpDesc.swift in Sources */
,
FC9797C921D6101D00F2FD90
/* ResizeBilinearOp.swift in Sources */
,
4AA1EA88214662BD00D0F791
/* BilinearInterpKernel.swift in Sources */
,
FC2BFD4621DF685F00C262B2
/* Scale.swift in Sources */
,
...
...
metal/paddle-mobile/paddle-mobile/Src/Framework/Loader.swift
浏览文件 @
5a68593c
...
...
@@ -13,7 +13,7 @@
limitations under the License. */
import
Foundation
import
SwiftProtobuf
//
import SwiftProtobuf
public
class
Loader
<
P
:
PrecisionType
>
{
class
ParaLoader
{
...
...
@@ -145,13 +145,17 @@ public class Loader<P: PrecisionType> {
public
init
(){}
func
loadModelandParam
(
_
device
:
MTLDevice
,
_
modelData
:
Data
,
_
paraLoaderPointer
:
ParaLoaderWithPointer
?,
_
paraLoader
:
ParaLoader
?)
throws
->
Program
{
do
{
let
protoProgram
=
try
PaddleMobile_Framework_Proto_ProgramDesc
.
init
(
serializedData
:
modelData
)
/// swift protobuf serialized Data to instance class
// let protoProgram = try PaddleMobile_Framework_Proto_ProgramDesc.init(
// serializedData: modelData)
/// oc protobuf serialized Data to instance class
let
protoProgram
=
try
ProgramDesc
.
init
(
data
:
(
modelData
as
NSData
)
as
Data
)
let
originProgramDesc
=
ProgramDesc
.
init
(
protoProgram
:
protoProgram
)
let
originProgramDesc
=
P
MP
rogramDesc
.
init
(
protoProgram
:
protoProgram
)
let
programDesc
=
ProgramOptimize
<
P
>.
init
()
.
optimize
(
originProgramDesc
:
originProgramDesc
)
// let programDesc = ProgramDesc.init(protoProgram: protoProgram)
// let programDesc = P
MP
rogramDesc.init(protoProgram: protoProgram)
print
(
programDesc
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/OpCreator.swift
浏览文件 @
5a68593c
...
...
@@ -27,7 +27,7 @@ class OpCreator<P: PrecisionType> {
}
}
func
creat
(
device
:
MTLDevice
,
opDesc
:
OpDesc
,
scope
:
Scope
,
initContext
:
InitContext
)
throws
->
Runable
&
InferShaperable
{
func
creat
(
device
:
MTLDevice
,
opDesc
:
PM
OpDesc
,
scope
:
Scope
,
initContext
:
InitContext
)
throws
->
Runable
&
InferShaperable
{
guard
let
opCreator
=
opCreators
[
opDesc
.
type
]
else
{
throw
PaddleMobileError
.
opError
(
message
:
"there is no "
+
opDesc
.
type
+
" yet"
)
}
...
...
@@ -39,7 +39,7 @@ class OpCreator<P: PrecisionType> {
}
}
let
opCreators
:
[
String
:
(
MTLDevice
,
OpDesc
,
Scope
,
InitContext
)
throws
->
Runable
&
InferShaperable
]
=
let
opCreators
:
[
String
:
(
MTLDevice
,
PM
OpDesc
,
Scope
,
InitContext
)
throws
->
Runable
&
InferShaperable
]
=
[
gConvType
:
ConvOp
<
P
>.
creat
,
gBatchNormType
:
BatchNormOp
<
P
>.
creat
,
gReluType
:
ReluOp
<
P
>.
creat
,
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/OpParam.swift
浏览文件 @
5a68593c
...
...
@@ -27,7 +27,7 @@ protocol OpParam {
func
outputDesc
()
->
String
//associatedtype ParamPrecisionType: PrecisionType
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
static
func
getFirstTensor
<
VarType
:
Variant
>
(
key
:
String
,
map
:
[
String
:
[
String
]],
from
:
Scope
)
throws
->
VarType
static
func
inputX
<
VarType
:
Variant
>
(
inputs
:
[
String
:
[
String
]],
from
:
Scope
)
throws
->
VarType
static
func
inputBiase
<
VarType
:
Variant
>
(
inputs
:
[
String
:
[
String
]],
from
:
Scope
)
throws
->
VarType
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/Operator.swift
浏览文件 @
5a68593c
...
...
@@ -72,11 +72,11 @@ public class InitContext {
protocol
Creator
where
Self
:
OperatorProtocol
{
associatedtype
OpType
:
OperatorProtocol
&
Runable
&
InferShaperable
static
func
creat
(
device
:
MTLDevice
,
opDesc
:
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
->
OpType
static
func
creat
(
device
:
MTLDevice
,
opDesc
:
PM
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
->
OpType
}
extension
Creator
where
Self
:
OperatorProtocol
{
static
func
creat
(
device
:
MTLDevice
,
opDesc
:
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
->
OpType
{
static
func
creat
(
device
:
MTLDevice
,
opDesc
:
PM
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
->
OpType
{
do
{
return
try
OpType
.
provide
(
device
:
device
,
opDesc
:
opDesc
,
inScope
:
inScope
,
initContext
:
initContext
)
}
catch
let
error
{
...
...
@@ -100,11 +100,11 @@ protocol OperatorProtocol {
var
attrs
:
[
String
:
Attr
]
{
get
}
var
para
:
ParamType
{
get
}
var
kernel
:
KerType
{
get
}
init
(
device
:
MTLDevice
,
opDesc
:
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
init
(
device
:
MTLDevice
,
opDesc
:
PM
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
}
extension
OperatorProtocol
{
static
func
provide
(
device
:
MTLDevice
,
opDesc
:
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
->
Self
{
static
func
provide
(
device
:
MTLDevice
,
opDesc
:
PM
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
->
Self
{
do
{
return
try
Self
.
init
(
device
:
device
,
opDesc
:
opDesc
,
inScope
:
inScope
,
initContext
:
initContext
)
}
catch
let
error
{
...
...
@@ -114,7 +114,7 @@ extension OperatorProtocol {
}
class
Operator
<
KernelType
:
Computable
,
ParameterType
>
:
OperatorProtocol
where
KernelType
.
ParamType
==
ParameterType
{
required
init
(
device
:
MTLDevice
,
opDesc
:
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
{
required
init
(
device
:
MTLDevice
,
opDesc
:
PM
OpDesc
,
inScope
:
Scope
,
initContext
:
InitContext
)
throws
{
type
=
opDesc
.
type
scope
=
inScope
inputs
=
opDesc
.
inputs
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/BatchNormOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Metal
class
BatchNormParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
BatchNormParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
if
input
.
transpose
!=
[
0
,
2
,
3
,
1
]
{
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/BilinearInterpOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Metal
class
BilinearInterpParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
BilinearInterpParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
BilinearInterpParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/BoxcoderOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
BoxcoderParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
priorBox
=
try
BoxcoderParam
.
getFirstTensor
(
key
:
"PriorBox"
,
map
:
opDesc
.
inputs
,
from
:
inScope
)
priorBoxVar
=
try
BoxcoderParam
.
getFirstTensor
(
key
:
"PriorBoxVar"
,
map
:
opDesc
.
inputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ConcatOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
ConcatParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
guard
let
xlist
=
opDesc
.
inputs
[
"X"
]
else
{
fatalError
()
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddAddPreluOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Metal
class
ConvAddAddPreluParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
filter
=
try
ConvAddAddPreluParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
input
=
try
ConvAddAddPreluParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddBatchNormReluOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Foundation
class
ConvAddBatchNormReluParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
filter
=
try
ConvAddBatchNormReluParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
ConvAddParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
filter
=
try
ConvAddParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
input
=
try
ConvAddParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddPreluOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
ConvAddPreluParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
filter
=
try
ConvAddPreluParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
input
=
try
ConvAddPreluParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvBNReluOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
ConvBNReluParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
filter
=
try
ConvBNReluParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
input
=
try
ConvBNReluParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
ConvParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
filter
=
try
ConvParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
input
=
try
ConvParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvTransposeOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
ConvTransposeParam
<
P
:
PrecisionType
>
:
ConvParam
<
P
>
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
try
super
.
init
(
opDesc
:
opDesc
,
inScope
:
inScope
)
}
catch
let
error
{
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ElementwiseAddOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Metal
class
ElementwiseAddParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
inputX
=
try
ElementwiseAddParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
ElementwiseAddParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ElementwiseAddPreluOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Metal
class
ElementwiseAddPreluParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
alpha
=
try
ElementwiseAddPreluParam
.
paramInputAlpha
(
inputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
mode
=
try
ElementwiseAddPreluParam
.
getAttr
(
key
:
"mode"
,
attrs
:
opDesc
.
attrs
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/FeedOp.swift
浏览文件 @
5a68593c
...
...
@@ -23,7 +23,7 @@ class FeedParam<P: PrecisionType>: OpParam{
}
let
scope
:
Scope
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
scope
=
inScope
do
{
output
=
try
FeedParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/FetchOp.swift
浏览文件 @
5a68593c
...
...
@@ -19,7 +19,7 @@ class FetchParam<P: PrecisionType>: OpParam{
var
output
:
FetchHolder
let
input
:
Texture
let
scope
:
Scope
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
scope
=
inScope
do
{
input
=
try
FetchParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/FlattenOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
FlattenParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
FlattenParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
FlattenParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/metal/BufferToTexture.metal
0 → 100644
浏览文件 @
5a68593c
//
// RGBToYCrCb_Y.metal
// paddle-mobile-demo
//
// Created by liuRuiLong on 2018/12/28.
// Copyright © 2018 orange. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
kernel void buffer_to_texture_kernel(
const device float *input [[buffer(0)]],
texture2d<float, access::write> outTexture [[texture(0)]],
uint2 gid [[thread_position_in_grid]]){
if (gid.x >= outTexture.get_width() ||
gid.y >= outTexture.get_height()) {
return;
}
float y = input[outTexture.get_width() * gid.y + gid.x];
outTexture.write(float4(y, 0.0f, 0.0f, 0.0f), gid);
}
kernel void buffer_to_texture_kernel_half(const device float *input [[buffer(0)]],
texture2d<half, access::write> outTexture [[texture(0)]],
uint2 gid [[thread_position_in_grid]]){
if (gid.x >= outTexture.get_width() ||
gid.y >= outTexture.get_height()) {
return;
}
float y = input[outTexture.get_width() * gid.y + gid.x];
outTexture.write(half4(y, 0.0f, 0.0f, 0.0f), gid);
}
metal/paddle-mobile/paddle-mobile/Src/Operators/MulticlassNMSOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
MulticlassNMSParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
scores
=
try
MulticlassNMSParam
.
getFirstTensor
(
key
:
"Scores"
,
map
:
opDesc
.
inputs
,
from
:
inScope
)
bboxes
=
try
MulticlassNMSParam
.
getFirstTensor
(
key
:
"BBoxes"
,
map
:
opDesc
.
inputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/PoolOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
PoolParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
PoolParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
PoolParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/PreluOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
PreluParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
PreluParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
PreluParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/PriorBoxOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
PriorBoxParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
min_max_aspect_ratios_order
=
try
PriorBoxParam
.
getAttr
(
key
:
"min_max_aspect_ratios_order"
,
attrs
:
opDesc
.
attrs
)
}
catch
_
{
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ReluOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Foundation
class
ReluParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
ReluParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
ReluParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ReshapeOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Metal
class
ReshapeParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
ReshapeParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
ReshapeParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ResizeBilinearOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
ResizeBilinearParam
<
P
:
PrecisionType
>
:
OpParam
{
typealias
ParamPrecisionType
=
P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
ResizeBilinearParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
// if (input.transpose != [0, 2, 3, 1]) || (input.tensorDim.cout() != 4) {
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ShapeOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
ShapeParam
<
P
:
PrecisionType
>
:
OpParam
{
// typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
ShapeParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
ShapeParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/SoftmaxOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Metal
class
SoftmaxParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
SoftmaxParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
SoftmaxParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/SplitOp.swift
浏览文件 @
5a68593c
...
...
@@ -16,7 +16,7 @@ import Foundation
class
SplitParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
SplitParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
Texture
.
init
(
device
:
input
.
metalTexture
!.
device
,
inDim
:
input
.
dim
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/TransposeOp.swift
浏览文件 @
5a68593c
...
...
@@ -17,7 +17,7 @@ import Metal
class
TransposeParam
<
P
:
PrecisionType
>
:
OpParam
{
//typealias ParamPrecisionType = P
required
init
(
opDesc
:
OpDesc
,
inScope
:
Scope
)
throws
{
required
init
(
opDesc
:
PM
OpDesc
,
inScope
:
Scope
)
throws
{
do
{
input
=
try
TransposeParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
TransposeParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Program/Attribute.swift
浏览文件 @
5a68593c
...
...
@@ -35,7 +35,11 @@ extension Array: Attr {
extension
String
:
Attr
{
}
func
attrWithProtoDesc
(
attrDesc
:
PaddleMobile_Framework_Proto_OpDesc
.
Attr
)
->
Attr
{
extension
NSMutableArray
:
Attr
{
}
func
attrWithProtoDesc
(
attrDesc
:
OpDesc_Attr
)
->
Attr
{
switch
attrDesc
.
type
{
case
.
boolean
:
return
attrDesc
.
b
...
...
@@ -47,14 +51,33 @@ func attrWithProtoDesc(attrDesc: PaddleMobile_Framework_Proto_OpDesc.Attr) -> At
return
attrDesc
.
l
case
.
float
:
return
attrDesc
.
f
/// convert GPB class to swift class
case
.
booleans
:
return
attrDesc
.
bools
var
dimsArray
=
[
Bool
]()
let
dimsCount
=
attrDesc
.
boolsArray
.
count
for
i
in
0
..<
dimsCount
{
let
dim
=
Bool
(
attrDesc
.
boolsArray
.
value
(
at
:
i
))
dimsArray
.
append
(
dim
)
}
return
dimsArray
case
.
floats
:
return
attrDesc
.
floats
var
dimsArray
=
[
Float
]()
let
dimsCount
=
attrDesc
.
floatsArray
.
count
for
i
in
0
..<
dimsCount
{
let
dim
=
Float
(
attrDesc
.
floatsArray
.
value
(
at
:
i
))
dimsArray
.
append
(
dim
)
}
return
dimsArray
case
.
ints
:
return
attrDesc
.
ints
var
dimsArray
=
[
Int32
]()
let
dimsCount
=
attrDesc
.
intsArray
.
count
for
i
in
0
..<
dimsCount
{
let
dim
=
Int32
(
attrDesc
.
intsArray
.
value
(
at
:
i
))
dimsArray
.
append
(
dim
)
}
return
dimsArray
case
.
strings
:
return
attrDesc
.
strings
return
attrDesc
.
strings
Array
default
:
fatalError
(
" not support this attr type:
\(
attrDesc
.
type
)
"
)
}
...
...
metal/paddle-mobile/paddle-mobile/Src/Program/Framework.pbobjc.h
0 → 100755
浏览文件 @
5a68593c
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Framework.proto
// This CPP symbol can be defined to use imports that match up to the framework
// imports needed when using CocoaPods.
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
#endif
//#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
// #import <Protobuf/GPBProtocolBuffers.h>
//#else
// #import "GPBProtocolBuffers.h"
//#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/GPBProtocolBuffers.h>
#else
#import <ProtocolBuffers/ProtocolBuffers.h>
#endif
#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
#error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
CF_EXTERN_C_BEGIN
@class
BlockDesc
;
@class
OpDesc
;
@class
OpDesc_Attr
;
@class
OpDesc_Var
;
@class
OpProto_Attr
;
@class
OpProto_Var
;
@class
VarDesc
;
@class
VarType
;
@class
VarType_ChannelDesc
;
@class
VarType_LoDTensorArrayDesc
;
@class
VarType_LoDTensorDesc
;
@class
VarType_ReaderDesc
;
@class
VarType_TensorDesc
;
@class
VarType_Tuple
;
@class
Version
;
NS_ASSUME_NONNULL_BEGIN
#pragma mark - Enum AttrType
typedef
GPB_ENUM
(
AttrType
)
{
AttrType_Int
=
0
,
AttrType_Float
=
1
,
AttrType_String
=
2
,
AttrType_Ints
=
3
,
AttrType_Floats
=
4
,
AttrType_Strings
=
5
,
AttrType_Boolean
=
6
,
AttrType_Booleans
=
7
,
AttrType_Block
=
8
,
AttrType_Long
=
9
,
AttrType_Blocks
=
10
,
};
GPBEnumDescriptor
*
AttrType_EnumDescriptor
(
void
);
/// Checks to see if the given value is defined by the enum or was not known at
/// the time this source was generated.
BOOL
AttrType_IsValidValue
(
int32_t
value
);
#pragma mark - Enum VarType_Type
typedef
GPB_ENUM
(
VarType_Type
)
{
/// Pod Types
VarType_Type_Bool
=
0
,
VarType_Type_Int16
=
1
,
VarType_Type_Int32
=
2
,
VarType_Type_Int64
=
3
,
VarType_Type_Fp16
=
4
,
VarType_Type_Fp32
=
5
,
VarType_Type_Fp64
=
6
,
/// Tensor<size_t> is used in C++.
VarType_Type_SizeT
=
19
,
VarType_Type_Uint8
=
20
,
VarType_Type_Int8
=
21
,
/// Other types that may need additional descriptions
VarType_Type_LodTensor
=
7
,
VarType_Type_SelectedRows
=
8
,
VarType_Type_FeedMinibatch
=
9
,
VarType_Type_FetchList
=
10
,
VarType_Type_StepScopes
=
11
,
VarType_Type_LodRankTable
=
12
,
VarType_Type_LodTensorArray
=
13
,
VarType_Type_PlaceList
=
14
,
VarType_Type_Reader
=
15
,
VarType_Type_Channel
=
16
,
/// Any runtime decided variable type is raw
/// raw variables should manage their own allocations
/// in operators like nccl_op
VarType_Type_Raw
=
17
,
VarType_Type_Tuple
=
18
,
};
GPBEnumDescriptor
*
VarType_Type_EnumDescriptor
(
void
);
/// Checks to see if the given value is defined by the enum or was not known at
/// the time this source was generated.
BOOL
VarType_Type_IsValidValue
(
int32_t
value
);
#pragma mark - FrameworkRoot
/// Exposes the extension registry for this file.
///
/// The base class provides:
/// @code
/// + (GPBExtensionRegistry *)extensionRegistry;
/// @endcode
/// which is a @c GPBExtensionRegistry that includes all the extensions defined by
/// this file and all files that it depends on.
@interface
FrameworkRoot
:
GPBRootObject
@end
#pragma mark - Version
typedef
GPB_ENUM
(
Version_FieldNumber
)
{
Version_FieldNumber_Version
=
1
,
};
/// Any incompatible changes to ProgramDesc and its dependencies should
/// raise the version defined version.h.
///
/// Serailization and Deserialization codes should be modified in a way
/// that supports old versions following the version and compatibility policy.
@interface
Version
:
GPBMessage
@property
(
nonatomic
,
readwrite
)
int64_t
version
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasVersion
;
@end
#pragma mark - OpDesc
typedef
GPB_ENUM
(
OpDesc_FieldNumber
)
{
OpDesc_FieldNumber_InputsArray
=
1
,
OpDesc_FieldNumber_OutputsArray
=
2
,
OpDesc_FieldNumber_Type
=
3
,
OpDesc_FieldNumber_AttrsArray
=
4
,
OpDesc_FieldNumber_IsTarget
=
5
,
};
/// OpDesc describes an instance of a C++ framework::OperatorBase
/// derived class type.
@interface
OpDesc
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
type
;
/// Test to see if @c type has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasType
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
OpDesc_Var
*>
*
inputsArray
;
/// The number of items in @c inputsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
inputsArray_Count
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
OpDesc_Var
*>
*
outputsArray
;
/// The number of items in @c outputsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
outputsArray_Count
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
OpDesc_Attr
*>
*
attrsArray
;
/// The number of items in @c attrsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
attrsArray_Count
;
@property
(
nonatomic
,
readwrite
)
BOOL
isTarget
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasIsTarget
;
@end
#pragma mark - OpDesc_Attr
typedef
GPB_ENUM
(
OpDesc_Attr_FieldNumber
)
{
OpDesc_Attr_FieldNumber_Name
=
1
,
OpDesc_Attr_FieldNumber_Type
=
2
,
OpDesc_Attr_FieldNumber_I
=
3
,
OpDesc_Attr_FieldNumber_F
=
4
,
OpDesc_Attr_FieldNumber_S
=
5
,
OpDesc_Attr_FieldNumber_IntsArray
=
6
,
OpDesc_Attr_FieldNumber_FloatsArray
=
7
,
OpDesc_Attr_FieldNumber_StringsArray
=
8
,
OpDesc_Attr_FieldNumber_B
=
10
,
OpDesc_Attr_FieldNumber_BoolsArray
=
11
,
OpDesc_Attr_FieldNumber_BlockIdx
=
12
,
OpDesc_Attr_FieldNumber_L
=
13
,
OpDesc_Attr_FieldNumber_BlocksIdxArray
=
14
,
};
@interface
OpDesc_Attr
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
name
;
/// Test to see if @c name has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasName
;
@property
(
nonatomic
,
readwrite
)
AttrType
type
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasType
;
@property
(
nonatomic
,
readwrite
)
int32_t
i
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasI
;
@property
(
nonatomic
,
readwrite
)
float
f
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasF
;
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
s
;
/// Test to see if @c s has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasS
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
GPBInt32Array
*
intsArray
;
/// The number of items in @c intsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
intsArray_Count
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
GPBFloatArray
*
floatsArray
;
/// The number of items in @c floatsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
floatsArray_Count
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
NSString
*>
*
stringsArray
;
/// The number of items in @c stringsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
stringsArray_Count
;
@property
(
nonatomic
,
readwrite
)
BOOL
b
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasB
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
GPBBoolArray
*
boolsArray
;
/// The number of items in @c boolsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
boolsArray_Count
;
@property
(
nonatomic
,
readwrite
)
int32_t
blockIdx
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasBlockIdx
;
@property
(
nonatomic
,
readwrite
)
int64_t
l
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasL
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
GPBInt32Array
*
blocksIdxArray
;
/// The number of items in @c blocksIdxArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
blocksIdxArray_Count
;
@end
#pragma mark - OpDesc_Var
typedef
GPB_ENUM
(
OpDesc_Var_FieldNumber
)
{
OpDesc_Var_FieldNumber_Parameter
=
1
,
OpDesc_Var_FieldNumber_ArgumentsArray
=
2
,
};
@interface
OpDesc_Var
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
parameter
;
/// Test to see if @c parameter has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasParameter
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
NSString
*>
*
argumentsArray
;
/// The number of items in @c argumentsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
argumentsArray_Count
;
@end
#pragma mark - OpProto
typedef
GPB_ENUM
(
OpProto_FieldNumber
)
{
OpProto_FieldNumber_Type
=
1
,
OpProto_FieldNumber_InputsArray
=
2
,
OpProto_FieldNumber_OutputsArray
=
3
,
OpProto_FieldNumber_AttrsArray
=
4
,
OpProto_FieldNumber_Comment
=
5
,
};
/// OpProto describes a C++ framework::OperatorBase derived class.
@interface
OpProto
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
type
;
/// Test to see if @c type has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasType
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
OpProto_Var
*>
*
inputsArray
;
/// The number of items in @c inputsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
inputsArray_Count
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
OpProto_Var
*>
*
outputsArray
;
/// The number of items in @c outputsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
outputsArray_Count
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
OpProto_Attr
*>
*
attrsArray
;
/// The number of items in @c attrsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
attrsArray_Count
;
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
comment
;
/// Test to see if @c comment has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasComment
;
@end
#pragma mark - OpProto_Var
typedef
GPB_ENUM
(
OpProto_Var_FieldNumber
)
{
OpProto_Var_FieldNumber_Name
=
1
,
OpProto_Var_FieldNumber_Comment
=
2
,
OpProto_Var_FieldNumber_Duplicable
=
3
,
OpProto_Var_FieldNumber_Intermediate
=
4
,
OpProto_Var_FieldNumber_Dispensable
=
5
,
OpProto_Var_FieldNumber_Reuse
=
6
,
};
/// VarProto describes the C++ type framework::Variable.
@interface
OpProto_Var
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
name
;
/// Test to see if @c name has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasName
;
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
comment
;
/// Test to see if @c comment has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasComment
;
@property
(
nonatomic
,
readwrite
)
BOOL
duplicable
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasDuplicable
;
@property
(
nonatomic
,
readwrite
)
BOOL
intermediate
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasIntermediate
;
@property
(
nonatomic
,
readwrite
)
BOOL
dispensable
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasDispensable
;
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
reuse
;
/// Test to see if @c reuse has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasReuse
;
@end
#pragma mark - OpProto_Attr
typedef
GPB_ENUM
(
OpProto_Attr_FieldNumber
)
{
OpProto_Attr_FieldNumber_Name
=
1
,
OpProto_Attr_FieldNumber_Type
=
2
,
OpProto_Attr_FieldNumber_Comment
=
3
,
OpProto_Attr_FieldNumber_Generated
=
4
,
};
/// AttrProto describes the C++ type Attribute.
@interface
OpProto_Attr
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
name
;
/// Test to see if @c name has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasName
;
@property
(
nonatomic
,
readwrite
)
AttrType
type
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasType
;
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
comment
;
/// Test to see if @c comment has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasComment
;
/// 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.
@property
(
nonatomic
,
readwrite
)
BOOL
generated
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasGenerated
;
@end
#pragma mark - VarType
typedef
GPB_ENUM
(
VarType_FieldNumber
)
{
VarType_FieldNumber_Type
=
1
,
VarType_FieldNumber_SelectedRows
=
2
,
VarType_FieldNumber_LodTensor
=
3
,
VarType_FieldNumber_TensorArray_p
=
4
,
VarType_FieldNumber_Reader
=
5
,
VarType_FieldNumber_Channel
=
6
,
VarType_FieldNumber_Tuple
=
7
,
};
@interface
VarType
:
GPBMessage
@property
(
nonatomic
,
readwrite
)
VarType_Type
type
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasType
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
VarType_TensorDesc
*
selectedRows
;
/// Test to see if @c selectedRows has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasSelectedRows
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
VarType_LoDTensorDesc
*
lodTensor
;
/// Test to see if @c lodTensor has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasLodTensor
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
VarType_LoDTensorArrayDesc
*
tensorArray_p
;
/// Test to see if @c tensorArray_p has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasTensorArray_p
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
VarType_ReaderDesc
*
reader
;
/// Test to see if @c reader has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasReader
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
VarType_ChannelDesc
*
channel
;
/// Test to see if @c channel has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasChannel
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
VarType_Tuple
*
tuple
;
/// Test to see if @c tuple has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasTuple
;
@end
#pragma mark - VarType_TensorDesc
typedef
GPB_ENUM
(
VarType_TensorDesc_FieldNumber
)
{
VarType_TensorDesc_FieldNumber_DataType
=
1
,
VarType_TensorDesc_FieldNumber_DimsArray
=
2
,
};
@interface
VarType_TensorDesc
:
GPBMessage
/// Should only be PODType. Is enforced in C++
@property
(
nonatomic
,
readwrite
)
VarType_Type
dataType
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasDataType
;
/// [UNK, 640, 480] is saved as [-1, 640, 480]
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
GPBInt64Array
*
dimsArray
;
/// The number of items in @c dimsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
dimsArray_Count
;
@end
#pragma mark - VarType_LoDTensorDesc
typedef
GPB_ENUM
(
VarType_LoDTensorDesc_FieldNumber
)
{
VarType_LoDTensorDesc_FieldNumber_Tensor
=
1
,
VarType_LoDTensorDesc_FieldNumber_LodLevel
=
2
,
};
@interface
VarType_LoDTensorDesc
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
VarType_TensorDesc
*
tensor
;
/// Test to see if @c tensor has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasTensor
;
@property
(
nonatomic
,
readwrite
)
int32_t
lodLevel
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasLodLevel
;
@end
#pragma mark - VarType_LoDTensorArrayDesc
typedef
GPB_ENUM
(
VarType_LoDTensorArrayDesc_FieldNumber
)
{
VarType_LoDTensorArrayDesc_FieldNumber_Tensor
=
1
,
VarType_LoDTensorArrayDesc_FieldNumber_LodLevel
=
2
,
};
@interface
VarType_LoDTensorArrayDesc
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
VarType_TensorDesc
*
tensor
;
/// Test to see if @c tensor has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasTensor
;
@property
(
nonatomic
,
readwrite
)
int32_t
lodLevel
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasLodLevel
;
@end
#pragma mark - VarType_ReaderDesc
typedef
GPB_ENUM
(
VarType_ReaderDesc_FieldNumber
)
{
VarType_ReaderDesc_FieldNumber_LodTensorArray
=
1
,
};
@interface
VarType_ReaderDesc
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
VarType_LoDTensorDesc
*>
*
lodTensorArray
;
/// The number of items in @c lodTensorArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
lodTensorArray_Count
;
@end
#pragma mark - VarType_ChannelDesc
typedef
GPB_ENUM
(
VarType_ChannelDesc_FieldNumber
)
{
VarType_ChannelDesc_FieldNumber_DataType
=
1
,
VarType_ChannelDesc_FieldNumber_Capacity
=
2
,
};
@interface
VarType_ChannelDesc
:
GPBMessage
@property
(
nonatomic
,
readwrite
)
VarType_Type
dataType
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasDataType
;
@property
(
nonatomic
,
readwrite
)
int64_t
capacity
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasCapacity
;
@end
#pragma mark - VarType_Tuple
typedef
GPB_ENUM
(
VarType_Tuple_FieldNumber
)
{
VarType_Tuple_FieldNumber_ElementTypeArray
=
1
,
};
@interface
VarType_Tuple
:
GPBMessage
// |elementTypeArray| contains |VarType_Type|
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
GPBEnumArray
*
elementTypeArray
;
/// The number of items in @c elementTypeArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
elementTypeArray_Count
;
@end
#pragma mark - VarDesc
typedef
GPB_ENUM
(
VarDesc_FieldNumber
)
{
VarDesc_FieldNumber_Name
=
1
,
VarDesc_FieldNumber_Type
=
2
,
VarDesc_FieldNumber_Persistable
=
3
,
};
@interface
VarDesc
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
copy
,
null_resettable
)
NSString
*
name
;
/// Test to see if @c name has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasName
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
VarType
*
type
;
/// Test to see if @c type has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasType
;
@property
(
nonatomic
,
readwrite
)
BOOL
persistable
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasPersistable
;
@end
#pragma mark - BlockDesc
typedef
GPB_ENUM
(
BlockDesc_FieldNumber
)
{
BlockDesc_FieldNumber_Idx
=
1
,
BlockDesc_FieldNumber_ParentIdx
=
2
,
BlockDesc_FieldNumber_VarsArray
=
3
,
BlockDesc_FieldNumber_OpsArray
=
4
,
BlockDesc_FieldNumber_ForwardBlockIdx
=
5
,
};
@interface
BlockDesc
:
GPBMessage
@property
(
nonatomic
,
readwrite
)
int32_t
idx
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasIdx
;
@property
(
nonatomic
,
readwrite
)
int32_t
parentIdx
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasParentIdx
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
VarDesc
*>
*
varsArray
;
/// The number of items in @c varsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
varsArray_Count
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
OpDesc
*>
*
opsArray
;
/// The number of items in @c opsArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
opsArray_Count
;
@property
(
nonatomic
,
readwrite
)
int32_t
forwardBlockIdx
;
@property
(
nonatomic
,
readwrite
)
BOOL
hasForwardBlockIdx
;
@end
#pragma mark - ProgramDesc
typedef
GPB_ENUM
(
ProgramDesc_FieldNumber
)
{
ProgramDesc_FieldNumber_BlocksArray
=
1
,
ProgramDesc_FieldNumber_Version
=
2
,
};
/// 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?
@interface
ProgramDesc
:
GPBMessage
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
NSMutableArray
<
BlockDesc
*>
*
blocksArray
;
/// The number of items in @c blocksArray without causing the array to be created.
@property
(
nonatomic
,
readonly
)
NSUInteger
blocksArray_Count
;
@property
(
nonatomic
,
readwrite
,
strong
,
null_resettable
)
Version
*
version
;
/// Test to see if @c version has been set.
@property
(
nonatomic
,
readwrite
)
BOOL
hasVersion
;
@end
NS_ASSUME_NONNULL_END
CF_EXTERN_C_END
#pragma clang diagnostic pop
// @@protoc_insertion_point(global_scope)
metal/paddle-mobile/paddle-mobile/Src/Program/Framework.pbobjc.m
0 → 100755
浏览文件 @
5a68593c
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Framework.proto
// This CPP symbol can be defined to use imports that match up to the framework
// imports needed when using CocoaPods.
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
#endif
//#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
// #import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
//#else
// #import "GPBProtocolBuffers_RuntimeSupport.h"
//#endif
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
#else
#import <ProtocolBuffers/GPBProtocolBuffers_RuntimeSupport.h>
#endif
#import "Framework.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#pragma mark - FrameworkRoot
@implementation
FrameworkRoot
@end
#pragma mark - FrameworkRoot_FileDescriptor
static
GPBFileDescriptor
*
FrameworkRoot_FileDescriptor
(
void
)
{
// This is called by +initialize so there is no need to worry
// about thread safety of the singleton.
static
GPBFileDescriptor
*
descriptor
=
NULL
;
if
(
!
descriptor
)
{
GPBDebugCheckRuntimeVersion
();
descriptor
=
[[
GPBFileDescriptor
alloc
]
initWithPackage
:
@"paddle_mobile.framework.proto"
syntax:
GPBFileSyntaxProto2
];
}
return
descriptor
;
}
#pragma mark - Enum AttrType
GPBEnumDescriptor
*
AttrType_EnumDescriptor
(
void
)
{
static
GPBEnumDescriptor
*
descriptor
=
NULL
;
if
(
!
descriptor
)
{
static
const
char
*
valueNames
=
"Int
\000
Float
\000
String
\000
Ints
\000
Floats
\000
Strings
\000
Boo"
"lean
\000
Booleans
\000
Block
\000
Long
\000
Blocks
\000
"
;
static
const
int32_t
values
[]
=
{
AttrType_Int
,
AttrType_Float
,
AttrType_String
,
AttrType_Ints
,
AttrType_Floats
,
AttrType_Strings
,
AttrType_Boolean
,
AttrType_Booleans
,
AttrType_Block
,
AttrType_Long
,
AttrType_Blocks
,
};
GPBEnumDescriptor
*
worker
=
[
GPBEnumDescriptor
allocDescriptorForName
:
GPBNSStringifySymbol
(
AttrType
)
valueNames:
valueNames
values:
values
count:
(
uint32_t
)(
sizeof
(
values
)
/
sizeof
(
int32_t
))
enumVerifier:
AttrType_IsValidValue
];
if
(
!
OSAtomicCompareAndSwapPtrBarrier
(
nil
,
worker
,
(
void
*
volatile
*
)
&
descriptor
))
{
[
worker
release
];
}
}
return
descriptor
;
}
BOOL
AttrType_IsValidValue
(
int32_t
value__
)
{
switch
(
value__
)
{
case
AttrType_Int
:
case
AttrType_Float
:
case
AttrType_String
:
case
AttrType_Ints
:
case
AttrType_Floats
:
case
AttrType_Strings
:
case
AttrType_Boolean
:
case
AttrType_Booleans
:
case
AttrType_Block
:
case
AttrType_Long
:
case
AttrType_Blocks
:
return
YES
;
default:
return
NO
;
}
}
#pragma mark - Version
@implementation
Version
@dynamic
hasVersion
,
version
;
typedef
struct
Version__storage_
{
uint32_t
_has_storage_
[
1
];
int64_t
version
;
}
Version__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"version"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
Version_FieldNumber_Version
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
Version__storage_
,
version
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
dataType
=
GPBDataTypeInt64
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
Version
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
Version__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - OpDesc
@implementation
OpDesc
@dynamic
hasType
,
type
;
@dynamic
inputsArray
,
inputsArray_Count
;
@dynamic
outputsArray
,
outputsArray_Count
;
@dynamic
attrsArray
,
attrsArray_Count
;
@dynamic
hasIsTarget
,
isTarget
;
typedef
struct
OpDesc__storage_
{
uint32_t
_has_storage_
[
1
];
NSMutableArray
*
inputsArray
;
NSMutableArray
*
outputsArray
;
NSString
*
type
;
NSMutableArray
*
attrsArray
;
}
OpDesc__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"inputsArray"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
OpDesc_Var
),
.
number
=
OpDesc_FieldNumber_InputsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc__storage_
,
inputsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"outputsArray"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
OpDesc_Var
),
.
number
=
OpDesc_FieldNumber_OutputsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc__storage_
,
outputsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"type"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_FieldNumber_Type
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc__storage_
,
type
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"attrsArray"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
OpDesc_Attr
),
.
number
=
OpDesc_FieldNumber_AttrsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc__storage_
,
attrsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"isTarget"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_FieldNumber_IsTarget
,
.
hasIndex
=
1
,
.
offset
=
2
,
// Stored in _has_storage_ to save space.
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
dataType
=
GPBDataTypeBool
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
OpDesc
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
OpDesc__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - OpDesc_Attr
@implementation
OpDesc_Attr
@dynamic
hasName
,
name
;
@dynamic
hasType
,
type
;
@dynamic
hasI
,
i
;
@dynamic
hasF
,
f
;
@dynamic
hasS
,
s
;
@dynamic
intsArray
,
intsArray_Count
;
@dynamic
floatsArray
,
floatsArray_Count
;
@dynamic
stringsArray
,
stringsArray_Count
;
@dynamic
hasB
,
b
;
@dynamic
boolsArray
,
boolsArray_Count
;
@dynamic
hasBlockIdx
,
blockIdx
;
@dynamic
hasL
,
l
;
@dynamic
blocksIdxArray
,
blocksIdxArray_Count
;
typedef
struct
OpDesc_Attr__storage_
{
uint32_t
_has_storage_
[
1
];
AttrType
type
;
int32_t
i
;
float
f
;
int32_t
blockIdx
;
NSString
*
name
;
NSString
*
s
;
GPBInt32Array
*
intsArray
;
GPBFloatArray
*
floatsArray
;
NSMutableArray
*
stringsArray
;
GPBBoolArray
*
boolsArray
;
GPBInt32Array
*
blocksIdxArray
;
int64_t
l
;
}
OpDesc_Attr__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"name"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_Name
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
name
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"type"
,
.
dataTypeSpecific
.
enumDescFunc
=
AttrType_EnumDescriptor
,
.
number
=
OpDesc_Attr_FieldNumber_Type
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
type
),
.
flags
=
GPBFieldRequired
|
GPBFieldHasEnumDescriptor
,
.
dataType
=
GPBDataTypeEnum
,
},
{
.
name
=
"i"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_I
,
.
hasIndex
=
2
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
i
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeInt32
,
},
{
.
name
=
"f"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_F
,
.
hasIndex
=
3
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
f
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeFloat
,
},
{
.
name
=
"s"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_S
,
.
hasIndex
=
4
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
s
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"intsArray"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_IntsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
intsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeInt32
,
},
{
.
name
=
"floatsArray"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_FloatsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
floatsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeFloat
,
},
{
.
name
=
"stringsArray"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_StringsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
stringsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"b"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_B
,
.
hasIndex
=
5
,
.
offset
=
6
,
// Stored in _has_storage_ to save space.
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeBool
,
},
{
.
name
=
"boolsArray"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_BoolsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
boolsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeBool
,
},
{
.
name
=
"blockIdx"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_BlockIdx
,
.
hasIndex
=
7
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
blockIdx
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeInt32
,
},
{
.
name
=
"l"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_L
,
.
hasIndex
=
8
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
l
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeInt64
,
},
{
.
name
=
"blocksIdxArray"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Attr_FieldNumber_BlocksIdxArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Attr__storage_
,
blocksIdxArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeInt32
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
OpDesc_Attr
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
OpDesc_Attr__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - OpDesc_Var
@implementation
OpDesc_Var
@dynamic
hasParameter
,
parameter
;
@dynamic
argumentsArray
,
argumentsArray_Count
;
typedef
struct
OpDesc_Var__storage_
{
uint32_t
_has_storage_
[
1
];
NSString
*
parameter
;
NSMutableArray
*
argumentsArray
;
}
OpDesc_Var__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"parameter"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Var_FieldNumber_Parameter
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Var__storage_
,
parameter
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"argumentsArray"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpDesc_Var_FieldNumber_ArgumentsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpDesc_Var__storage_
,
argumentsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeString
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
OpDesc_Var
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
OpDesc_Var__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - OpProto
@implementation
OpProto
@dynamic
hasType
,
type
;
@dynamic
inputsArray
,
inputsArray_Count
;
@dynamic
outputsArray
,
outputsArray_Count
;
@dynamic
attrsArray
,
attrsArray_Count
;
@dynamic
hasComment
,
comment
;
typedef
struct
OpProto__storage_
{
uint32_t
_has_storage_
[
1
];
NSString
*
type
;
NSMutableArray
*
inputsArray
;
NSMutableArray
*
outputsArray
;
NSMutableArray
*
attrsArray
;
NSString
*
comment
;
}
OpProto__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"type"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_FieldNumber_Type
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto__storage_
,
type
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"inputsArray"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
OpProto_Var
),
.
number
=
OpProto_FieldNumber_InputsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto__storage_
,
inputsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"outputsArray"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
OpProto_Var
),
.
number
=
OpProto_FieldNumber_OutputsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto__storage_
,
outputsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"attrsArray"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
OpProto_Attr
),
.
number
=
OpProto_FieldNumber_AttrsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto__storage_
,
attrsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"comment"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_FieldNumber_Comment
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto__storage_
,
comment
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
OpProto
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
OpProto__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - OpProto_Var
@implementation
OpProto_Var
@dynamic
hasName
,
name
;
@dynamic
hasComment
,
comment
;
@dynamic
hasDuplicable
,
duplicable
;
@dynamic
hasIntermediate
,
intermediate
;
@dynamic
hasDispensable
,
dispensable
;
@dynamic
hasReuse
,
reuse
;
typedef
struct
OpProto_Var__storage_
{
uint32_t
_has_storage_
[
1
];
NSString
*
name
;
NSString
*
comment
;
NSString
*
reuse
;
}
OpProto_Var__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"name"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_Var_FieldNumber_Name
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto_Var__storage_
,
name
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"comment"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_Var_FieldNumber_Comment
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto_Var__storage_
,
comment
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"duplicable"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_Var_FieldNumber_Duplicable
,
.
hasIndex
=
2
,
.
offset
=
3
,
// Stored in _has_storage_ to save space.
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
dataType
=
GPBDataTypeBool
,
},
{
.
name
=
"intermediate"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_Var_FieldNumber_Intermediate
,
.
hasIndex
=
4
,
.
offset
=
5
,
// Stored in _has_storage_ to save space.
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
dataType
=
GPBDataTypeBool
,
},
{
.
name
=
"dispensable"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_Var_FieldNumber_Dispensable
,
.
hasIndex
=
6
,
.
offset
=
7
,
// Stored in _has_storage_ to save space.
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
dataType
=
GPBDataTypeBool
,
},
{
.
name
=
"reuse"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_Var_FieldNumber_Reuse
,
.
hasIndex
=
8
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto_Var__storage_
,
reuse
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeString
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
OpProto_Var
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
OpProto_Var__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - OpProto_Attr
@implementation
OpProto_Attr
@dynamic
hasName
,
name
;
@dynamic
hasType
,
type
;
@dynamic
hasComment
,
comment
;
@dynamic
hasGenerated
,
generated
;
typedef
struct
OpProto_Attr__storage_
{
uint32_t
_has_storage_
[
1
];
AttrType
type
;
NSString
*
name
;
NSString
*
comment
;
}
OpProto_Attr__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"name"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_Attr_FieldNumber_Name
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto_Attr__storage_
,
name
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"type"
,
.
dataTypeSpecific
.
enumDescFunc
=
AttrType_EnumDescriptor
,
.
number
=
OpProto_Attr_FieldNumber_Type
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto_Attr__storage_
,
type
),
.
flags
=
GPBFieldRequired
|
GPBFieldHasEnumDescriptor
,
.
dataType
=
GPBDataTypeEnum
,
},
{
.
name
=
"comment"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_Attr_FieldNumber_Comment
,
.
hasIndex
=
2
,
.
offset
=
(
uint32_t
)
offsetof
(
OpProto_Attr__storage_
,
comment
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"generated"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
OpProto_Attr_FieldNumber_Generated
,
.
hasIndex
=
3
,
.
offset
=
4
,
// Stored in _has_storage_ to save space.
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
dataType
=
GPBDataTypeBool
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
OpProto_Attr
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
OpProto_Attr__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - VarType
@implementation
VarType
@dynamic
hasType
,
type
;
@dynamic
hasSelectedRows
,
selectedRows
;
@dynamic
hasLodTensor
,
lodTensor
;
@dynamic
hasTensorArray_p
,
tensorArray_p
;
@dynamic
hasReader
,
reader
;
@dynamic
hasChannel
,
channel
;
@dynamic
hasTuple
,
tuple
;
typedef
struct
VarType__storage_
{
uint32_t
_has_storage_
[
1
];
VarType_Type
type
;
VarType_TensorDesc
*
selectedRows
;
VarType_LoDTensorDesc
*
lodTensor
;
VarType_LoDTensorArrayDesc
*
tensorArray_p
;
VarType_ReaderDesc
*
reader
;
VarType_ChannelDesc
*
channel
;
VarType_Tuple
*
tuple
;
}
VarType__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"type"
,
.
dataTypeSpecific
.
enumDescFunc
=
VarType_Type_EnumDescriptor
,
.
number
=
VarType_FieldNumber_Type
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType__storage_
,
type
),
.
flags
=
GPBFieldRequired
|
GPBFieldHasEnumDescriptor
,
.
dataType
=
GPBDataTypeEnum
,
},
{
.
name
=
"selectedRows"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType_TensorDesc
),
.
number
=
VarType_FieldNumber_SelectedRows
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType__storage_
,
selectedRows
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"lodTensor"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType_LoDTensorDesc
),
.
number
=
VarType_FieldNumber_LodTensor
,
.
hasIndex
=
2
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType__storage_
,
lodTensor
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"tensorArray_p"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType_LoDTensorArrayDesc
),
.
number
=
VarType_FieldNumber_TensorArray_p
,
.
hasIndex
=
3
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType__storage_
,
tensorArray_p
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"reader"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType_ReaderDesc
),
.
number
=
VarType_FieldNumber_Reader
,
.
hasIndex
=
4
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType__storage_
,
reader
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"channel"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType_ChannelDesc
),
.
number
=
VarType_FieldNumber_Channel
,
.
hasIndex
=
5
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType__storage_
,
channel
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"tuple"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType_Tuple
),
.
number
=
VarType_FieldNumber_Tuple
,
.
hasIndex
=
6
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType__storage_
,
tuple
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeMessage
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
VarType
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
VarType__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - Enum VarType_Type
GPBEnumDescriptor
*
VarType_Type_EnumDescriptor
(
void
)
{
static
GPBEnumDescriptor
*
descriptor
=
NULL
;
if
(
!
descriptor
)
{
static
const
char
*
valueNames
=
"Bool
\000
Int16
\000
Int32
\000
Int64
\000
Fp16
\000
Fp32
\000
Fp64
\000
Si"
"zeT
\000
Uint8
\000
Int8
\000
LodTensor
\000
SelectedRows
\000
Fe"
"edMinibatch
\000
FetchList
\000
StepScopes
\000
LodRank"
"Table
\000
LodTensorArray
\000
PlaceList
\000
Reader
\000
Ch"
"annel
\000
Raw
\000
Tuple
\000
"
;
static
const
int32_t
values
[]
=
{
VarType_Type_Bool
,
VarType_Type_Int16
,
VarType_Type_Int32
,
VarType_Type_Int64
,
VarType_Type_Fp16
,
VarType_Type_Fp32
,
VarType_Type_Fp64
,
VarType_Type_SizeT
,
VarType_Type_Uint8
,
VarType_Type_Int8
,
VarType_Type_LodTensor
,
VarType_Type_SelectedRows
,
VarType_Type_FeedMinibatch
,
VarType_Type_FetchList
,
VarType_Type_StepScopes
,
VarType_Type_LodRankTable
,
VarType_Type_LodTensorArray
,
VarType_Type_PlaceList
,
VarType_Type_Reader
,
VarType_Type_Channel
,
VarType_Type_Raw
,
VarType_Type_Tuple
,
};
GPBEnumDescriptor
*
worker
=
[
GPBEnumDescriptor
allocDescriptorForName
:
GPBNSStringifySymbol
(
VarType_Type
)
valueNames:
valueNames
values:
values
count:
(
uint32_t
)(
sizeof
(
values
)
/
sizeof
(
int32_t
))
enumVerifier:
VarType_Type_IsValidValue
];
if
(
!
OSAtomicCompareAndSwapPtrBarrier
(
nil
,
worker
,
(
void
*
volatile
*
)
&
descriptor
))
{
[
worker
release
];
}
}
return
descriptor
;
}
BOOL
VarType_Type_IsValidValue
(
int32_t
value__
)
{
switch
(
value__
)
{
case
VarType_Type_Bool
:
case
VarType_Type_Int16
:
case
VarType_Type_Int32
:
case
VarType_Type_Int64
:
case
VarType_Type_Fp16
:
case
VarType_Type_Fp32
:
case
VarType_Type_Fp64
:
case
VarType_Type_SizeT
:
case
VarType_Type_Uint8
:
case
VarType_Type_Int8
:
case
VarType_Type_LodTensor
:
case
VarType_Type_SelectedRows
:
case
VarType_Type_FeedMinibatch
:
case
VarType_Type_FetchList
:
case
VarType_Type_StepScopes
:
case
VarType_Type_LodRankTable
:
case
VarType_Type_LodTensorArray
:
case
VarType_Type_PlaceList
:
case
VarType_Type_Reader
:
case
VarType_Type_Channel
:
case
VarType_Type_Raw
:
case
VarType_Type_Tuple
:
return
YES
;
default:
return
NO
;
}
}
#pragma mark - VarType_TensorDesc
@implementation
VarType_TensorDesc
@dynamic
hasDataType
,
dataType
;
@dynamic
dimsArray
,
dimsArray_Count
;
typedef
struct
VarType_TensorDesc__storage_
{
uint32_t
_has_storage_
[
1
];
VarType_Type
dataType
;
GPBInt64Array
*
dimsArray
;
}
VarType_TensorDesc__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"dataType"
,
.
dataTypeSpecific
.
enumDescFunc
=
VarType_Type_EnumDescriptor
,
.
number
=
VarType_TensorDesc_FieldNumber_DataType
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_TensorDesc__storage_
,
dataType
),
.
flags
=
GPBFieldRequired
|
GPBFieldHasEnumDescriptor
,
.
dataType
=
GPBDataTypeEnum
,
},
{
.
name
=
"dimsArray"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
VarType_TensorDesc_FieldNumber_DimsArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_TensorDesc__storage_
,
dimsArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeInt64
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
VarType_TensorDesc
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
VarType_TensorDesc__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - VarType_LoDTensorDesc
@implementation
VarType_LoDTensorDesc
@dynamic
hasTensor
,
tensor
;
@dynamic
hasLodLevel
,
lodLevel
;
typedef
struct
VarType_LoDTensorDesc__storage_
{
uint32_t
_has_storage_
[
1
];
int32_t
lodLevel
;
VarType_TensorDesc
*
tensor
;
}
VarType_LoDTensorDesc__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"tensor"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType_TensorDesc
),
.
number
=
VarType_LoDTensorDesc_FieldNumber_Tensor
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_LoDTensorDesc__storage_
,
tensor
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"lodLevel"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
VarType_LoDTensorDesc_FieldNumber_LodLevel
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_LoDTensorDesc__storage_
,
lodLevel
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
dataType
=
GPBDataTypeInt32
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
VarType_LoDTensorDesc
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
VarType_LoDTensorDesc__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - VarType_LoDTensorArrayDesc
@implementation
VarType_LoDTensorArrayDesc
@dynamic
hasTensor
,
tensor
;
@dynamic
hasLodLevel
,
lodLevel
;
typedef
struct
VarType_LoDTensorArrayDesc__storage_
{
uint32_t
_has_storage_
[
1
];
int32_t
lodLevel
;
VarType_TensorDesc
*
tensor
;
}
VarType_LoDTensorArrayDesc__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"tensor"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType_TensorDesc
),
.
number
=
VarType_LoDTensorArrayDesc_FieldNumber_Tensor
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_LoDTensorArrayDesc__storage_
,
tensor
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"lodLevel"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
VarType_LoDTensorArrayDesc_FieldNumber_LodLevel
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_LoDTensorArrayDesc__storage_
,
lodLevel
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
dataType
=
GPBDataTypeInt32
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
VarType_LoDTensorArrayDesc
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
VarType_LoDTensorArrayDesc__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - VarType_ReaderDesc
@implementation
VarType_ReaderDesc
@dynamic
lodTensorArray
,
lodTensorArray_Count
;
typedef
struct
VarType_ReaderDesc__storage_
{
uint32_t
_has_storage_
[
1
];
NSMutableArray
*
lodTensorArray
;
}
VarType_ReaderDesc__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"lodTensorArray"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType_LoDTensorDesc
),
.
number
=
VarType_ReaderDesc_FieldNumber_LodTensorArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_ReaderDesc__storage_
,
lodTensorArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeMessage
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
VarType_ReaderDesc
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
VarType_ReaderDesc__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - VarType_ChannelDesc
@implementation
VarType_ChannelDesc
@dynamic
hasDataType
,
dataType
;
@dynamic
hasCapacity
,
capacity
;
typedef
struct
VarType_ChannelDesc__storage_
{
uint32_t
_has_storage_
[
1
];
VarType_Type
dataType
;
int64_t
capacity
;
}
VarType_ChannelDesc__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"dataType"
,
.
dataTypeSpecific
.
enumDescFunc
=
VarType_Type_EnumDescriptor
,
.
number
=
VarType_ChannelDesc_FieldNumber_DataType
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_ChannelDesc__storage_
,
dataType
),
.
flags
=
GPBFieldRequired
|
GPBFieldHasEnumDescriptor
,
.
dataType
=
GPBDataTypeEnum
,
},
{
.
name
=
"capacity"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
VarType_ChannelDesc_FieldNumber_Capacity
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_ChannelDesc__storage_
,
capacity
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeInt64
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
VarType_ChannelDesc
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
VarType_ChannelDesc__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - VarType_Tuple
@implementation
VarType_Tuple
@dynamic
elementTypeArray
,
elementTypeArray_Count
;
typedef
struct
VarType_Tuple__storage_
{
uint32_t
_has_storage_
[
1
];
GPBEnumArray
*
elementTypeArray
;
}
VarType_Tuple__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"elementTypeArray"
,
.
dataTypeSpecific
.
enumDescFunc
=
VarType_Type_EnumDescriptor
,
.
number
=
VarType_Tuple_FieldNumber_ElementTypeArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
VarType_Tuple__storage_
,
elementTypeArray
),
.
flags
=
GPBFieldRepeated
|
GPBFieldHasEnumDescriptor
,
.
dataType
=
GPBDataTypeEnum
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
VarType_Tuple
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
VarType_Tuple__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - VarDesc
@implementation
VarDesc
@dynamic
hasName
,
name
;
@dynamic
hasType
,
type
;
@dynamic
hasPersistable
,
persistable
;
typedef
struct
VarDesc__storage_
{
uint32_t
_has_storage_
[
1
];
NSString
*
name
;
VarType
*
type
;
}
VarDesc__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"name"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
VarDesc_FieldNumber_Name
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
VarDesc__storage_
,
name
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeString
,
},
{
.
name
=
"type"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarType
),
.
number
=
VarDesc_FieldNumber_Type
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
VarDesc__storage_
,
type
),
.
flags
=
GPBFieldRequired
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"persistable"
,
.
dataTypeSpecific
.
className
=
NULL
,
.
number
=
VarDesc_FieldNumber_Persistable
,
.
hasIndex
=
2
,
.
offset
=
3
,
// Stored in _has_storage_ to save space.
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
dataType
=
GPBDataTypeBool
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
VarDesc
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
VarDesc__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - BlockDesc
@implementation
BlockDesc
@dynamic
hasIdx
,
idx
;
@dynamic
hasParentIdx
,
parentIdx
;
@dynamic
varsArray
,
varsArray_Count
;
@dynamic
opsArray
,
opsArray_Count
;
@dynamic
hasForwardBlockIdx
,
forwardBlockIdx
;
typedef
struct
BlockDesc__storage_
{
uint32_t
_has_storage_
[
1
];
int32_t
idx
;
int32_t
parentIdx
;
int32_t
forwardBlockIdx
;
NSMutableArray
*
varsArray
;
NSMutableArray
*
opsArray
;
}
BlockDesc__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescriptionWithDefault
fields
[]
=
{
{
.
defaultValue
.
valueInt32
=
0
,
.
core
.
name
=
"idx"
,
.
core
.
dataTypeSpecific
.
className
=
NULL
,
.
core
.
number
=
BlockDesc_FieldNumber_Idx
,
.
core
.
hasIndex
=
0
,
.
core
.
offset
=
(
uint32_t
)
offsetof
(
BlockDesc__storage_
,
idx
),
.
core
.
flags
=
GPBFieldRequired
,
.
core
.
dataType
=
GPBDataTypeInt32
,
},
{
.
defaultValue
.
valueInt32
=
0
,
.
core
.
name
=
"parentIdx"
,
.
core
.
dataTypeSpecific
.
className
=
NULL
,
.
core
.
number
=
BlockDesc_FieldNumber_ParentIdx
,
.
core
.
hasIndex
=
1
,
.
core
.
offset
=
(
uint32_t
)
offsetof
(
BlockDesc__storage_
,
parentIdx
),
.
core
.
flags
=
GPBFieldRequired
,
.
core
.
dataType
=
GPBDataTypeInt32
,
},
{
.
defaultValue
.
valueMessage
=
nil
,
.
core
.
name
=
"varsArray"
,
.
core
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
VarDesc
),
.
core
.
number
=
BlockDesc_FieldNumber_VarsArray
,
.
core
.
hasIndex
=
GPBNoHasBit
,
.
core
.
offset
=
(
uint32_t
)
offsetof
(
BlockDesc__storage_
,
varsArray
),
.
core
.
flags
=
GPBFieldRepeated
,
.
core
.
dataType
=
GPBDataTypeMessage
,
},
{
.
defaultValue
.
valueMessage
=
nil
,
.
core
.
name
=
"opsArray"
,
.
core
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
OpDesc
),
.
core
.
number
=
BlockDesc_FieldNumber_OpsArray
,
.
core
.
hasIndex
=
GPBNoHasBit
,
.
core
.
offset
=
(
uint32_t
)
offsetof
(
BlockDesc__storage_
,
opsArray
),
.
core
.
flags
=
GPBFieldRepeated
,
.
core
.
dataType
=
GPBDataTypeMessage
,
},
{
.
defaultValue
.
valueInt32
=
-
1
,
.
core
.
name
=
"forwardBlockIdx"
,
.
core
.
dataTypeSpecific
.
className
=
NULL
,
.
core
.
number
=
BlockDesc_FieldNumber_ForwardBlockIdx
,
.
core
.
hasIndex
=
2
,
.
core
.
offset
=
(
uint32_t
)
offsetof
(
BlockDesc__storage_
,
forwardBlockIdx
),
.
core
.
flags
=
GPBFieldOptional
|
GPBFieldHasDefaultValue
,
.
core
.
dataType
=
GPBDataTypeInt32
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
BlockDesc
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescriptionWithDefault
))
storageSize:
sizeof
(
BlockDesc__storage_
)
flags:
GPBDescriptorInitializationFlag_FieldsWithDefault
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma mark - ProgramDesc
@implementation
ProgramDesc
@dynamic
blocksArray
,
blocksArray_Count
;
@dynamic
hasVersion
,
version
;
typedef
struct
ProgramDesc__storage_
{
uint32_t
_has_storage_
[
1
];
NSMutableArray
*
blocksArray
;
Version
*
version
;
}
ProgramDesc__storage_
;
// This method is threadsafe because it is initially called
// in +initialize for each subclass.
+
(
GPBDescriptor
*
)
descriptor
{
static
GPBDescriptor
*
descriptor
=
nil
;
if
(
!
descriptor
)
{
static
GPBMessageFieldDescription
fields
[]
=
{
{
.
name
=
"blocksArray"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
BlockDesc
),
.
number
=
ProgramDesc_FieldNumber_BlocksArray
,
.
hasIndex
=
GPBNoHasBit
,
.
offset
=
(
uint32_t
)
offsetof
(
ProgramDesc__storage_
,
blocksArray
),
.
flags
=
GPBFieldRepeated
,
.
dataType
=
GPBDataTypeMessage
,
},
{
.
name
=
"version"
,
.
dataTypeSpecific
.
className
=
GPBStringifySymbol
(
Version
),
.
number
=
ProgramDesc_FieldNumber_Version
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
ProgramDesc__storage_
,
version
),
.
flags
=
GPBFieldOptional
,
.
dataType
=
GPBDataTypeMessage
,
},
};
GPBDescriptor
*
localDescriptor
=
[
GPBDescriptor
allocDescriptorForClass
:[
ProgramDesc
class
]
rootClass:
[
FrameworkRoot
class
]
file:
FrameworkRoot_FileDescriptor
()
fields:
fields
fieldCount:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize:
sizeof
(
ProgramDesc__storage_
)
flags:
0
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
return
descriptor
;
}
@end
#pragma clang diagnostic pop
// @@protoc_insertion_point(global_scope)
metal/paddle-mobile/paddle-mobile/Src/Program/BlockDesc.swift
→
metal/paddle-mobile/paddle-mobile/Src/Program/
PM
BlockDesc.swift
浏览文件 @
5a68593c
...
...
@@ -14,28 +14,28 @@
import
Foundation
public
class
BlockDesc
{
public
class
PM
BlockDesc
{
let
index
:
Int
let
parentIndex
:
Int
public
let
vars
:
[
VarDesc
]
let
ops
:
[
OpDesc
]
init
(
block
:
PaddleMobile_Framework_Proto_
BlockDesc
)
{
public
let
vars
:
[
PM
VarDesc
]
let
ops
:
[
PM
OpDesc
]
init
(
block
:
BlockDesc
)
{
index
=
Int
(
block
.
idx
)
parentIndex
=
Int
(
block
.
parentIdx
)
var
vars
:
[
VarDesc
]
=
[]
for
varOfBlock
in
block
.
vars
{
vars
.
append
(
VarDesc
.
init
(
protoVarDesc
:
varOfBlock
))
var
vars
:
[
PM
VarDesc
]
=
[]
for
varOfBlock
in
block
.
vars
Array
{
vars
.
append
(
PMVarDesc
.
init
(
protoVarDesc
:
varOfBlock
as!
VarDesc
))
}
vars
.
sort
{
$0
.
name
<
$1
.
name
}
self
.
vars
=
vars
var
ops
:
[
OpDesc
]
=
[]
for
op
in
block
.
ops
{
ops
.
append
(
OpDesc
.
init
(
protoOpDesc
:
op
))
var
ops
:
[
PM
OpDesc
]
=
[]
for
op
in
block
.
ops
Array
{
ops
.
append
(
PMOpDesc
.
init
(
protoOpDesc
:
op
as!
OpDesc
))
}
self
.
ops
=
ops
}
init
(
inVars
:
[
VarDesc
],
inOps
:
[
OpDesc
])
{
init
(
inVars
:
[
PMVarDesc
],
inOps
:
[
PM
OpDesc
])
{
vars
=
inVars
ops
=
inOps
index
=
0
...
...
@@ -44,7 +44,7 @@ public class BlockDesc {
}
extension
BlockDesc
:
CustomStringConvertible
,
CustomDebugStringConvertible
{
extension
PM
BlockDesc
:
CustomStringConvertible
,
CustomDebugStringConvertible
{
public
var
description
:
String
{
var
str
=
""
...
...
metal/paddle-mobile/paddle-mobile/Src/Program/OpDesc.swift
→
metal/paddle-mobile/paddle-mobile/Src/Program/
PM
OpDesc.swift
浏览文件 @
5a68593c
...
...
@@ -14,50 +14,50 @@
import
Foundation
class
OpDesc
{
class
PM
OpDesc
{
let
inputs
:
[
String
:
[
String
]]
var
paraInputs
:
[
String
:
[
String
]]
var
outputs
:
[
String
:
[
String
]]
let
unusedOutputs
:
[
String
:
[
String
]]
var
attrs
:
[
String
:
Attr
]
=
[:]
var
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
init
(
protoOpDesc
:
OpDesc
)
{
type
=
protoOpDesc
.
type
let
creator
=
{
(
vars
:
[
OpDesc_Var
],
canAdd
:
(
String
)
->
Bool
)
->
[
String
:
[
String
]]
in
var
map
:
[
String
:
[
String
]]
=
[:]
for
opDescVar
in
vars
{
if
(
canAdd
(
opDescVar
.
parameter
))
{
map
[
opDescVar
.
parameter
]
=
opDescVar
.
argumentsArray
as?
[
String
]
}
}
return
map
}
inputs
=
creator
(
protoOpDesc
.
inputsArray
as!
[
OpDesc_Var
])
{
opInfos
[
protoOpDesc
.
type
]?
.
inputs
.
contains
(
$0
)
??
false
}
paraInputs
=
creator
(
protoOpDesc
.
inputsArray
as!
[
OpDesc_Var
])
{
!
(
opInfos
[
protoOpDesc
.
type
]?
.
inputs
.
contains
(
$0
)
??
false
)
}
outputs
=
creator
(
protoOpDesc
.
outputsArray
as!
[
OpDesc_Var
])
{
opInfos
[
protoOpDesc
.
type
]?
.
outputs
.
contains
(
$0
)
??
false
}
unusedOutputs
=
creator
(
protoOpDesc
.
outputsArray
as!
[
OpDesc_Var
])
{
!
(
opInfos
[
protoOpDesc
.
type
]?
.
outputs
.
contains
(
$0
)
??
false
)
}
for
attr
in
protoOpDesc
.
attrsArray
{
if
((
attr
as!
OpDesc_Attr
)
.
type
!=
.
block
)
{
attrs
[(
attr
as!
OpDesc_Attr
)
.
name
]
=
attrWithProtoDesc
(
attrDesc
:
attr
as!
OpDesc_Attr
)
}
}
}
return
map
}
inputs
=
creator
(
protoOpDesc
.
inputs
)
{
opInfos
[
protoOpDesc
.
type
]?
.
inputs
.
contains
(
$0
)
??
false
}
paraInputs
=
creator
(
protoOpDesc
.
inputs
)
{
!
(
opInfos
[
protoOpDesc
.
type
]?
.
inputs
.
contains
(
$0
)
??
false
)
}
outputs
=
creator
(
protoOpDesc
.
outputs
)
{
opInfos
[
protoOpDesc
.
type
]?
.
outputs
.
contains
(
$0
)
??
false
}
unusedOutputs
=
creator
(
protoOpDesc
.
outputs
)
{
!
(
opInfos
[
protoOpDesc
.
type
]?
.
outputs
.
contains
(
$0
)
??
false
)
}
for
attr
in
protoOpDesc
.
attrs
{
if
(
attr
.
type
!=
.
block
)
{
attrs
[
attr
.
name
]
=
attrWithProtoDesc
(
attrDesc
:
attr
)
}
}
}
}
extension
OpDesc
:
CustomStringConvertible
,
CustomDebugStringConvertible
{
extension
PM
OpDesc
:
CustomStringConvertible
,
CustomDebugStringConvertible
{
var
description
:
String
{
var
str
=
""
str
+=
"op type:
\(
type
)
:
\n
"
...
...
metal/paddle-mobile/paddle-mobile/Src/Program/ProgramDesc.swift
→
metal/paddle-mobile/paddle-mobile/Src/Program/P
MP
rogramDesc.swift
浏览文件 @
5a68593c
...
...
@@ -14,11 +14,11 @@
import
Foundation
public
class
ProgramDesc
{
public
var
blocks
:
[
BlockDesc
]
=
[]
init
(
protoProgram
:
P
addleMobile_Framework_Proto_P
rogramDesc
)
{
for
block
in
protoProgram
.
blocks
{
self
.
blocks
.
append
(
BlockDesc
.
init
(
block
:
block
))
public
class
P
MP
rogramDesc
{
public
var
blocks
:
[
PM
BlockDesc
]
=
[]
init
(
protoProgram
:
ProgramDesc
)
{
for
block
in
protoProgram
.
blocks
Array
{
self
.
blocks
.
append
(
PMBlockDesc
.
init
(
block
:
block
as!
BlockDesc
))
}
}
...
...
@@ -26,7 +26,7 @@ public class ProgramDesc {
}
}
extension
ProgramDesc
:
CustomStringConvertible
,
CustomDebugStringConvertible
{
extension
P
MP
rogramDesc
:
CustomStringConvertible
,
CustomDebugStringConvertible
{
public
var
description
:
String
{
var
str
:
String
=
""
for
i
in
0
..<
blocks
.
count
{
...
...
metal/paddle-mobile/paddle-mobile/Src/Program/VarDesc.swift
→
metal/paddle-mobile/paddle-mobile/Src/Program/
PM
VarDesc.swift
浏览文件 @
5a68593c
...
...
@@ -56,13 +56,13 @@ public enum VarTypeType: Int {
}
}
public
class
VarDesc
{
public
class
PM
VarDesc
{
public
let
name
:
String
public
let
persistable
:
Bool
public
let
type
:
VarTypeType
let
tensorDesc
:
TensorDesc
?
init
(
protoVarDesc
:
PaddleMobile_Framework_Proto_
VarDesc
)
{
type
=
VarTypeType
.
init
(
rawValue
:
protoVarDesc
.
type
.
type
.
rawValue
)
??
.
ErrorType
init
(
protoVarDesc
:
VarDesc
)
{
type
=
VarTypeType
.
init
(
rawValue
:
Int
(
protoVarDesc
.
type
.
type
.
rawValue
)
)
??
.
ErrorType
name
=
protoVarDesc
.
name
persistable
=
protoVarDesc
.
persistable
switch
type
{
...
...
@@ -71,14 +71,14 @@ public class VarDesc {
case
.
LodTensor
:
tensorDesc
=
TensorDesc
.
init
(
protoTensorDesc
:
protoVarDesc
.
type
.
lodTensor
.
tensor
)
case
.
StepLodTensorArray
:
tensorDesc
=
TensorDesc
.
init
(
protoTensorDesc
:
protoVarDesc
.
type
.
tensorArray
.
tensor
);
tensorDesc
=
TensorDesc
.
init
(
protoTensorDesc
:
protoVarDesc
.
type
.
tensorArray
_p
.
tensor
);
default
:
tensorDesc
=
.
none
}
}
}
extension
VarDesc
:
CustomStringConvertible
,
CustomDebugStringConvertible
{
extension
PM
VarDesc
:
CustomStringConvertible
,
CustomDebugStringConvertible
{
public
var
description
:
String
{
var
str
=
""
str
+=
"var name
\(
name
)
:
\n
"
...
...
metal/paddle-mobile/paddle-mobile/Src/Program/Program.swift
浏览文件 @
5a68593c
...
...
@@ -16,14 +16,14 @@ import Foundation
@objc
public
class
Program
:
NSObject
{
public
let
paramPath
:
String
public
let
programDesc
:
ProgramDesc
public
let
programDesc
:
P
MP
rogramDesc
public
let
scope
:
Scope
init
(
inProgramDesc
:
ProgramDesc
,
inParamPath
:
String
,
inScope
:
Scope
)
{
init
(
inProgramDesc
:
P
MP
rogramDesc
,
inParamPath
:
String
,
inScope
:
Scope
)
{
programDesc
=
inProgramDesc
paramPath
=
inParamPath
scope
=
inScope
}
init
(
inProgramDesc
:
ProgramDesc
,
inScope
:
Scope
)
{
init
(
inProgramDesc
:
P
MP
rogramDesc
,
inScope
:
Scope
)
{
programDesc
=
inProgramDesc
scope
=
inScope
paramPath
=
""
...
...
metal/paddle-mobile/paddle-mobile/Src/Program/ProgramOptimize.swift
浏览文件 @
5a68593c
...
...
@@ -25,8 +25,8 @@ class Node {
var
inputs
:
[
Node
]
=
[]
var
outputs
:
[
Node
]
=
[]
var
type
:
String
var
opDesc
:
OpDesc
?
init
(
inOpDesc
:
OpDesc
)
{
var
opDesc
:
PM
OpDesc
?
init
(
inOpDesc
:
PM
OpDesc
)
{
type
=
inOpDesc
.
type
opDesc
=
inOpDesc
}
...
...
@@ -192,7 +192,7 @@ class ProgramOptimize<P: PrecisionType> {
ElementwiseAddPreluOp
<
P
>.
self
]
func
optimize
(
originProgramDesc
:
P
rogramDesc
)
->
ProgramDesc
{
func
optimize
(
originProgramDesc
:
P
MProgramDesc
)
->
PM
ProgramDesc
{
guard
originProgramDesc
.
blocks
.
count
==
1
else
{
fatalError
(
" not support yet"
)
...
...
@@ -287,13 +287,13 @@ class ProgramOptimize<P: PrecisionType> {
}
}
var
ops
:
[
OpDesc
]
=
[]
var
ops
:
[
PM
OpDesc
]
=
[]
for
node
in
nodes
{
ops
.
append
(
node
.
opDesc
!
)
}
var
newProgramDesc
=
ProgramDesc
.
init
()
let
newBlock
=
BlockDesc
.
init
(
inVars
:
block
.
vars
,
inOps
:
ops
)
let
newProgramDesc
=
PM
ProgramDesc
.
init
()
let
newBlock
=
PM
BlockDesc
.
init
(
inVars
:
block
.
vars
,
inOps
:
ops
)
newProgramDesc
.
blocks
.
append
(
newBlock
)
return
newProgramDesc
}
...
...
metal/paddle-mobile/paddle-mobile/Src/Program/TensorDesc.swift
浏览文件 @
5a68593c
...
...
@@ -52,9 +52,19 @@ class TensorDesc {
}
}
init
(
protoTensorDesc
:
PaddleMobile_Framework_Proto_VarType
.
TensorDesc
)
{
dims
=
protoTensorDesc
.
dims
.
map
{
Int
(
$0
)
>
0
?
Int
(
$0
)
:
abs
(
Int
(
$0
))
}
dataType
=
VarTypeType
.
init
(
rawValue
:
protoTensorDesc
.
dataType
.
rawValue
)
??
.
ErrorType
init
(
protoTensorDesc
:
VarType_TensorDesc
)
{
// dims = protoTensorDesc.dimsArray.map{ Int64($0)! > 0 ? Int64($0) : abs(Int64($0)) }
var
dimsArray
=
[
Int
]()
let
dimsCount
=
protoTensorDesc
.
dimsArray
.
count
for
i
in
0
..<
dimsCount
{
let
dim
=
Int
(
protoTensorDesc
.
dimsArray
.
value
(
at
:
i
))
>
0
?
Int
(
protoTensorDesc
.
dimsArray
.
value
(
at
:
i
))
:
abs
(
Int
(
protoTensorDesc
.
dimsArray
.
value
(
at
:
i
)))
dimsArray
.
append
(
dim
)
}
dims
=
dimsArray
dataType
=
VarTypeType
.
init
(
rawValue
:
Int
(
protoTensorDesc
.
dataType
.
rawValue
))
??
.
ErrorType
}
}
metal/paddle-mobile/paddle-mobile/Src/Program/framework.pb.swift
浏览文件 @
5a68593c
...
...
@@ -21,7 +21,6 @@
//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
...
...
metal/paddle-mobile/paddle-mobile/paddle_mobile.h
浏览文件 @
5a68593c
...
...
@@ -15,6 +15,7 @@
#pragma once
#import <UIKit/UIKit.h>
#import <paddle_mobile/Framework.pbobjc.h>
//! Project version number for paddle_mobile.
//FOUNDATION_EXPORT double paddle_mobileVersionNumber;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录