Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
005115a1
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
338
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看板
提交
005115a1
编写于
3月 05, 2019
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format files, improve accuracy
上级
93a1705a
变更
142
展开全部
显示空白变更内容
内联
并排
Showing
142 changed file
with
10223 addition
and
10245 deletion
+10223
-10245
metal/MobileNetDemo/MobileNetDemo/AppDelegate.swift
metal/MobileNetDemo/MobileNetDemo/AppDelegate.swift
+32
-32
metal/MobileNetDemo/MobileNetDemo/MobileNet.swift
metal/MobileNetDemo/MobileNetDemo/MobileNet.swift
+41
-41
metal/MobileNetDemo/MobileNetDemo/MobilenetPreProcess.metal
metal/MobileNetDemo/MobileNetDemo/MobilenetPreProcess.metal
+14
-14
metal/MobileNetDemo/MobileNetDemo/ViewController.swift
metal/MobileNetDemo/MobileNetDemo/ViewController.swift
+66
-66
metal/paddle-mobile-demo/paddle-mobile-demo/AppDelegate.swift
...l/paddle-mobile-demo/paddle-mobile-demo/AppDelegate.swift
+9
-9
metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard
...mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard
+1
-1
metal/paddle-mobile-demo/paddle-mobile-demo/MetalHelper.swift
...l/paddle-mobile-demo/paddle-mobile-demo/MetalHelper.swift
+10
-10
metal/paddle-mobile-demo/paddle-mobile-demo/MultiPredictViewController.swift
...-demo/paddle-mobile-demo/MultiPredictViewController.swift
+46
-46
metal/paddle-mobile-demo/paddle-mobile-demo/Net/CPUCompute.mm
...l/paddle-mobile-demo/paddle-mobile-demo/Net/CPUCompute.mm
+217
-217
metal/paddle-mobile-demo/paddle-mobile-demo/Net/Genet.swift
metal/paddle-mobile-demo/paddle-mobile-demo/Net/Genet.swift
+32
-32
metal/paddle-mobile-demo/paddle-mobile-demo/Net/MobileNet.swift
...paddle-mobile-demo/paddle-mobile-demo/Net/MobileNet.swift
+43
-43
metal/paddle-mobile-demo/paddle-mobile-demo/Net/MobileNetCombined.swift
...obile-demo/paddle-mobile-demo/Net/MobileNetCombined.swift
+14
-14
metal/paddle-mobile-demo/paddle-mobile-demo/Net/MobileNetSSD.swift
...dle-mobile-demo/paddle-mobile-demo/Net/MobileNetSSD.swift
+79
-79
metal/paddle-mobile-demo/paddle-mobile-demo/Net/MobilenetSSD_AR.swift
...-mobile-demo/paddle-mobile-demo/Net/MobilenetSSD_AR.swift
+128
-128
metal/paddle-mobile-demo/paddle-mobile-demo/Net/PreProcessKernel.metal
...mobile-demo/paddle-mobile-demo/Net/PreProcessKernel.metal
+40
-40
metal/paddle-mobile-demo/paddle-mobile-demo/Net/YoloNet.swift
...l/paddle-mobile-demo/paddle-mobile-demo/Net/YoloNet.swift
+14
-14
metal/paddle-mobile-demo/paddle-mobile-demo/OCDemo/LoadPointerViewController.m
...emo/paddle-mobile-demo/OCDemo/LoadPointerViewController.m
+68
-68
metal/paddle-mobile-demo/paddle-mobile-demo/OCInterface/PaddleMobileGPU.h
...ile-demo/paddle-mobile-demo/OCInterface/PaddleMobileGPU.h
+2
-2
metal/paddle-mobile-demo/paddle-mobile-demo/OCInterface/PaddleMobileGPU.m
...ile-demo/paddle-mobile-demo/OCInterface/PaddleMobileGPU.m
+42
-42
metal/paddle-mobile-demo/paddle-mobile-demo/OCInterface/SuperResolutionNet.swift
...o/paddle-mobile-demo/OCInterface/SuperResolutionNet.swift
+48
-48
metal/paddle-mobile-demo/paddle-mobile-demo/VideoCapture/FPSCounter.swift
...ile-demo/paddle-mobile-demo/VideoCapture/FPSCounter.swift
+21
-21
metal/paddle-mobile-demo/paddle-mobile-demo/VideoCapture/VideoCapture.swift
...e-demo/paddle-mobile-demo/VideoCapture/VideoCapture.swift
+56
-56
metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift
...addle-mobile-demo/paddle-mobile-demo/ViewController.swift
+194
-217
metal/paddle-mobile-metallib/paddle-mobile-metallib.xcodeproj/project.pbxproj
...metallib/paddle-mobile-metallib.xcodeproj/project.pbxproj
+4
-2
metal/paddle-mobile-metallib/paddle-mobile-metallib/BatchNormKernel.metal
...ile-metallib/paddle-mobile-metallib/BatchNormKernel.metal
+16
-16
metal/paddle-mobile-metallib/paddle-mobile-metallib/BatchNormRelu.metal
...obile-metallib/paddle-mobile-metallib/BatchNormRelu.metal
+5
-5
metal/paddle-mobile-metallib/paddle-mobile-metallib/BilinearInterp.inc.metal
...-metallib/paddle-mobile-metallib/BilinearInterp.inc.metal
+23
-23
metal/paddle-mobile-metallib/paddle-mobile-metallib/BilinearInterp.metal
...bile-metallib/paddle-mobile-metallib/BilinearInterp.metal
+2
-2
metal/paddle-mobile-metallib/paddle-mobile-metallib/BoxCoder.inc.metal
...mobile-metallib/paddle-mobile-metallib/BoxCoder.inc.metal
+29
-29
metal/paddle-mobile-metallib/paddle-mobile-metallib/BufferToTexture.metal
...ile-metallib/paddle-mobile-metallib/BufferToTexture.metal
+14
-14
metal/paddle-mobile-metallib/paddle-mobile-metallib/Common.metal
...addle-mobile-metallib/paddle-mobile-metallib/Common.metal
+62
-62
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConcatKernel.inc.metal
...le-metallib/paddle-mobile-metallib/ConcatKernel.inc.metal
+164
-164
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConcatKernel.metal
...mobile-metallib/paddle-mobile-metallib/ConcatKernel.metal
+95
-95
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvAddBNReluKernel.metal
...metallib/paddle-mobile-metallib/ConvAddBNReluKernel.metal
+238
-238
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvAddMetal.metal
...mobile-metallib/paddle-mobile-metallib/ConvAddMetal.metal
+520
-520
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvAddPrelu.inc.metal
...le-metallib/paddle-mobile-metallib/ConvAddPrelu.inc.metal
+346
-346
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvAddPreluKernel.metal
...-metallib/paddle-mobile-metallib/ConvAddPreluKernel.metal
+30
-30
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvBNReluKernel.metal
...le-metallib/paddle-mobile-metallib/ConvBNReluKernel.metal
+232
-232
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvKernel.metal
...e-mobile-metallib/paddle-mobile-metallib/ConvKernel.metal
+220
-220
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvTransposeKernel.metal
...metallib/paddle-mobile-metallib/ConvTransposeKernel.metal
+79
-79
metal/paddle-mobile-metallib/paddle-mobile-metallib/Elementwise.metal
...-mobile-metallib/paddle-mobile-metallib/Elementwise.metal
+67
-67
metal/paddle-mobile-metallib/paddle-mobile-metallib/ElementwiseAddPreluKernel.inc.metal
...addle-mobile-metallib/ElementwiseAddPreluKernel.inc.metal
+52
-52
metal/paddle-mobile-metallib/paddle-mobile-metallib/ElementwiseAddPreluKernel.metal
...ib/paddle-mobile-metallib/ElementwiseAddPreluKernel.metal
+7
-7
metal/paddle-mobile-metallib/paddle-mobile-metallib/FetchKernel.inc.metal
...ile-metallib/paddle-mobile-metallib/FetchKernel.inc.metal
+29
-29
metal/paddle-mobile-metallib/paddle-mobile-metallib/FetchKernel.metal
...-mobile-metallib/paddle-mobile-metallib/FetchKernel.metal
+1
-1
metal/paddle-mobile-metallib/paddle-mobile-metallib/Kernels.metal
...ddle-mobile-metallib/paddle-mobile-metallib/Kernels.metal
+26
-26
metal/paddle-mobile-metallib/paddle-mobile-metallib/NMSFetchResultKernel.metal
...etallib/paddle-mobile-metallib/NMSFetchResultKernel.metal
+50
-50
metal/paddle-mobile-metallib/paddle-mobile-metallib/PoolKernel.inc.metal
...bile-metallib/paddle-mobile-metallib/PoolKernel.inc.metal
+29
-29
metal/paddle-mobile-metallib/paddle-mobile-metallib/PoolKernel.metal
...e-mobile-metallib/paddle-mobile-metallib/PoolKernel.metal
+7
-7
metal/paddle-mobile-metallib/paddle-mobile-metallib/PreluKernel.metal
...-mobile-metallib/paddle-mobile-metallib/PreluKernel.metal
+111
-111
metal/paddle-mobile-metallib/paddle-mobile-metallib/PriorBoxKernel.metal
...bile-metallib/paddle-mobile-metallib/PriorBoxKernel.metal
+292
-292
metal/paddle-mobile-metallib/paddle-mobile-metallib/ReluKernel.metal
...e-mobile-metallib/paddle-mobile-metallib/ReluKernel.metal
+18
-18
metal/paddle-mobile-metallib/paddle-mobile-metallib/ReshapeKernel.inc.metal
...e-metallib/paddle-mobile-metallib/ReshapeKernel.inc.metal
+30
-30
metal/paddle-mobile-metallib/paddle-mobile-metallib/ReshapeKernel.metal
...obile-metallib/paddle-mobile-metallib/ReshapeKernel.metal
+4
-4
metal/paddle-mobile-metallib/paddle-mobile-metallib/ResizeBilinear.metal
...bile-metallib/paddle-mobile-metallib/ResizeBilinear.metal
+50
-50
metal/paddle-mobile-metallib/paddle-mobile-metallib/Scale.metal
...paddle-mobile-metallib/paddle-mobile-metallib/Scale.metal
+14
-14
metal/paddle-mobile-metallib/paddle-mobile-metallib/Softmax.inc.metal
...-mobile-metallib/paddle-mobile-metallib/Softmax.inc.metal
+33
-33
metal/paddle-mobile-metallib/paddle-mobile-metallib/Softmax.metal
...ddle-mobile-metallib/paddle-mobile-metallib/Softmax.metal
+2
-2
metal/paddle-mobile-metallib/paddle-mobile-metallib/Split.inc.metal
...le-mobile-metallib/paddle-mobile-metallib/Split.inc.metal
+49
-49
metal/paddle-mobile-metallib/paddle-mobile-metallib/Split.metal
...paddle-mobile-metallib/paddle-mobile-metallib/Split.metal
+25
-25
metal/paddle-mobile-metallib/paddle-mobile-metallib/TransposeKernel.inc.metal
...metallib/paddle-mobile-metallib/TransposeKernel.inc.metal
+21
-21
metal/paddle-mobile-metallib/paddle-mobile-metallib/TransposeKernel.metal
...ile-metallib/paddle-mobile-metallib/TransposeKernel.metal
+29
-29
metal/paddle-mobile-unit-test/paddle-mobile-unit-test/AppDelegate.swift
...obile-unit-test/paddle-mobile-unit-test/AppDelegate.swift
+12
-12
metal/paddle-mobile-unit-test/paddle-mobile-unit-test/ViewController.swift
...le-unit-test/paddle-mobile-unit-test/ViewController.swift
+6
-6
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
+2
-2
metal/paddle-mobile/paddle-mobile/API/GlobalConfig.swift
metal/paddle-mobile/paddle-mobile/API/GlobalConfig.swift
+16
-14
metal/paddle-mobile/paddle-mobile/API/Net.swift
metal/paddle-mobile/paddle-mobile/API/Net.swift
+68
-68
metal/paddle-mobile/paddle-mobile/API/Runner.swift
metal/paddle-mobile/paddle-mobile/API/Runner.swift
+161
-161
metal/paddle-mobile/paddle-mobile/Src/Common/Extensions.swift
...l/paddle-mobile/paddle-mobile/Src/Common/Extensions.swift
+78
-78
metal/paddle-mobile/paddle-mobile/Src/Common/MetalExtension.swift
...ddle-mobile/paddle-mobile/Src/Common/MetalExtension.swift
+561
-561
metal/paddle-mobile/paddle-mobile/Src/Common/PaddleMobileUnitTest.swift
...obile/paddle-mobile/Src/Common/PaddleMobileUnitTest.swift
+188
-188
metal/paddle-mobile/paddle-mobile/Src/Common/Types.swift
metal/paddle-mobile/paddle-mobile/Src/Common/Types.swift
+207
-207
metal/paddle-mobile/paddle-mobile/Src/Framework/Dim.swift
metal/paddle-mobile/paddle-mobile/Src/Framework/Dim.swift
+37
-37
metal/paddle-mobile/paddle-mobile/Src/Framework/Executor.swift
.../paddle-mobile/paddle-mobile/Src/Framework/Executor.swift
+119
-114
metal/paddle-mobile/paddle-mobile/Src/Framework/Loader.swift
metal/paddle-mobile/paddle-mobile/Src/Framework/Loader.swift
+232
-232
metal/paddle-mobile/paddle-mobile/Src/Framework/Tensor.swift
metal/paddle-mobile/paddle-mobile/Src/Framework/Tensor.swift
+293
-293
metal/paddle-mobile/paddle-mobile/Src/Framework/Texture.swift
...l/paddle-mobile/paddle-mobile/Src/Framework/Texture.swift
+144
-144
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
+188
-188
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/Operator.swift
...le-mobile/paddle-mobile/Src/Operators/Base/Operator.swift
+90
-90
metal/paddle-mobile/paddle-mobile/Src/Operators/BatchNormOp.swift
...ddle-mobile/paddle-mobile/Src/Operators/BatchNormOp.swift
+43
-43
metal/paddle-mobile/paddle-mobile/Src/Operators/BilinearInterpOp.swift
...mobile/paddle-mobile/Src/Operators/BilinearInterpOp.swift
+39
-39
metal/paddle-mobile/paddle-mobile/Src/Operators/BoxcoderOp.swift
...addle-mobile/paddle-mobile/Src/Operators/BoxcoderOp.swift
+58
-58
metal/paddle-mobile/paddle-mobile/Src/Operators/ConcatOp.swift
.../paddle-mobile/paddle-mobile/Src/Operators/ConcatOp.swift
+49
-49
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddAddPreluOp.swift
...obile/paddle-mobile/Src/Operators/ConvAddAddPreluOp.swift
+83
-83
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddBatchNormReluOp.swift
.../paddle-mobile/Src/Operators/ConvAddBatchNormReluOp.swift
+101
-101
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddOp.swift
...paddle-mobile/paddle-mobile/Src/Operators/ConvAddOp.swift
+90
-90
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddPreluOp.swift
...e-mobile/paddle-mobile/Src/Operators/ConvAddPreluOp.swift
+76
-76
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvBNReluOp.swift
...dle-mobile/paddle-mobile/Src/Operators/ConvBNReluOp.swift
+90
-90
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvOp.swift
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvOp.swift
+56
-56
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvTransposeOp.swift
...-mobile/paddle-mobile/Src/Operators/ConvTransposeOp.swift
+33
-33
metal/paddle-mobile/paddle-mobile/Src/Operators/DepthwiseConvOp.swift
...-mobile/paddle-mobile/Src/Operators/DepthwiseConvOp.swift
+34
-34
metal/paddle-mobile/paddle-mobile/Src/Operators/DwConvBNReluOp.swift
...e-mobile/paddle-mobile/Src/Operators/DwConvBNReluOp.swift
+49
-49
metal/paddle-mobile/paddle-mobile/Src/Operators/ElementwiseAddOp.swift
...mobile/paddle-mobile/Src/Operators/ElementwiseAddOp.swift
+66
-66
metal/paddle-mobile/paddle-mobile/Src/Operators/ElementwiseAddPreluOp.swift
...e/paddle-mobile/Src/Operators/ElementwiseAddPreluOp.swift
+86
-86
metal/paddle-mobile/paddle-mobile/Src/Operators/FeedOp.swift
metal/paddle-mobile/paddle-mobile/Src/Operators/FeedOp.swift
+43
-43
metal/paddle-mobile/paddle-mobile/Src/Operators/FetchOp.swift
...l/paddle-mobile/paddle-mobile/Src/Operators/FetchOp.swift
+33
-33
metal/paddle-mobile/paddle-mobile/Src/Operators/FlattenOp.swift
...paddle-mobile/paddle-mobile/Src/Operators/FlattenOp.swift
+33
-33
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/Base/Kernel.swift
...ile/paddle-mobile/Src/Operators/Kernels/Base/Kernel.swift
+92
-92
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/BatchNormKernel.swift
...paddle-mobile/Src/Operators/Kernels/BatchNormKernel.swift
+33
-33
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/BilinearInterpKernel.swift
...e-mobile/Src/Operators/Kernels/BilinearInterpKernel.swift
+31
-31
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/BoxcoderKernel.swift
.../paddle-mobile/Src/Operators/Kernels/BoxcoderKernel.swift
+23
-23
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConcatKernel.swift
...le/paddle-mobile/Src/Operators/Kernels/ConcatKernel.swift
+114
-114
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvAddAddPreluKernel.swift
...-mobile/Src/Operators/Kernels/ConvAddAddPreluKernel.swift
+124
-124
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvAddBatchNormReluKernel.swift
...le/Src/Operators/Kernels/ConvAddBatchNormReluKernel.swift
+151
-151
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvAddKernel.swift
...e/paddle-mobile/Src/Operators/Kernels/ConvAddKernel.swift
+67
-67
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvAddPreluKernel.swift
...dle-mobile/Src/Operators/Kernels/ConvAddPreluKernel.swift
+124
-124
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvBNReluKernel.swift
...addle-mobile/Src/Operators/Kernels/ConvBNReluKernel.swift
+151
-151
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvKernel.swift
...bile/paddle-mobile/Src/Operators/Kernels/ConvKernel.swift
+36
-38
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvTransposeKernel.swift
...le-mobile/Src/Operators/Kernels/ConvTransposeKernel.swift
+57
-57
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ElementwiseAddKernel.swift
...e-mobile/Src/Operators/Kernels/ElementwiseAddKernel.swift
+50
-50
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ElementwiseAddPreluKernel.swift
...ile/Src/Operators/Kernels/ElementwiseAddPreluKernel.swift
+57
-57
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/FetchKernel.swift
...ile/paddle-mobile/Src/Operators/Kernels/FetchKernel.swift
+40
-40
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/FlattenKernel.swift
...e/paddle-mobile/Src/Operators/Kernels/FlattenKernel.swift
+47
-47
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/MulticlassNMSKernel.swift
...le-mobile/Src/Operators/Kernels/MulticlassNMSKernel.swift
+33
-33
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/PoolKernel.swift
...bile/paddle-mobile/Src/Operators/Kernels/PoolKernel.swift
+47
-47
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/PreluKernel.swift
...ile/paddle-mobile/Src/Operators/Kernels/PreluKernel.swift
+33
-33
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/PriorBoxKernel.swift
.../paddle-mobile/Src/Operators/Kernels/PriorBoxKernel.swift
+125
-125
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ReluKernel.swift
...bile/paddle-mobile/Src/Operators/Kernels/ReluKernel.swift
+17
-17
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ReshapeKernel.swift
...e/paddle-mobile/Src/Operators/Kernels/ReshapeKernel.swift
+70
-70
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ResizeBilinearKernel.swift
...e-mobile/Src/Operators/Kernels/ResizeBilinearKernel.swift
+27
-27
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/Scale.swift
...le-mobile/paddle-mobile/Src/Operators/Kernels/Scale.swift
+8
-8
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ShapeKernel.swift
...ile/paddle-mobile/Src/Operators/Kernels/ShapeKernel.swift
+19
-19
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/SoftmaxKernel.swift
...e/paddle-mobile/Src/Operators/Kernels/SoftmaxKernel.swift
+28
-28
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/SplitKernel.swift
...ile/paddle-mobile/Src/Operators/Kernels/SplitKernel.swift
+70
-70
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/Texture2DTo2DArrayKernel.swift
...bile/Src/Operators/Kernels/Texture2DTo2DArrayKernel.swift
+22
-22
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/TransposeKernel.swift
...paddle-mobile/Src/Operators/Kernels/TransposeKernel.swift
+55
-55
metal/paddle-mobile/paddle-mobile/Src/Operators/MulticlassNMSOp.swift
...-mobile/paddle-mobile/Src/Operators/MulticlassNMSOp.swift
+45
-45
metal/paddle-mobile/paddle-mobile/Src/Operators/PoolOp.swift
metal/paddle-mobile/paddle-mobile/Src/Operators/PoolOp.swift
+50
-50
metal/paddle-mobile/paddle-mobile/Src/Operators/PreluOp.swift
...l/paddle-mobile/paddle-mobile/Src/Operators/PreluOp.swift
+40
-40
metal/paddle-mobile/paddle-mobile/Src/Operators/PriorBoxOp.swift
...addle-mobile/paddle-mobile/Src/Operators/PriorBoxOp.swift
+94
-94
metal/paddle-mobile/paddle-mobile/Src/Operators/ReluOp.swift
metal/paddle-mobile/paddle-mobile/Src/Operators/ReluOp.swift
+33
-33
metal/paddle-mobile/paddle-mobile/Src/Operators/ReshapeOp.swift
...paddle-mobile/paddle-mobile/Src/Operators/ReshapeOp.swift
+53
-53
metal/paddle-mobile/paddle-mobile/Src/Operators/ResizeBilinearOp.swift
...mobile/paddle-mobile/Src/Operators/ResizeBilinearOp.swift
+35
-41
metal/paddle-mobile/paddle-mobile/Src/Operators/ShapeOp.swift
...l/paddle-mobile/paddle-mobile/Src/Operators/ShapeOp.swift
+28
-28
metal/paddle-mobile/paddle-mobile/Src/Operators/SoftmaxOp.swift
...paddle-mobile/paddle-mobile/Src/Operators/SoftmaxOp.swift
+38
-38
metal/paddle-mobile/paddle-mobile/Src/Operators/SplitOp.swift
...l/paddle-mobile/paddle-mobile/Src/Operators/SplitOp.swift
+50
-50
metal/paddle-mobile/paddle-mobile/Src/Operators/TransposeOp.swift
...ddle-mobile/paddle-mobile/Src/Operators/TransposeOp.swift
+32
-32
metal/paddle-mobile/paddle-mobile/Src/Program/PMBlockDesc.swift
...paddle-mobile/paddle-mobile/Src/Program/PMBlockDesc.swift
+5
-5
metal/paddle-mobile/paddle-mobile/Src/Program/PMOpDesc.swift
metal/paddle-mobile/paddle-mobile/Src/Program/PMOpDesc.swift
+25
-25
metal/paddle-mobile/paddle-mobile/Src/Program/PMVarDesc.swift
...l/paddle-mobile/paddle-mobile/Src/Program/PMVarDesc.swift
+2
-2
metal/paddle-mobile/paddle-mobile/Src/Program/ProgramOptimize.swift
...le-mobile/paddle-mobile/Src/Program/ProgramOptimize.swift
+234
-234
未找到文件。
metal/MobileNetDemo/MobileNetDemo/AppDelegate.swift
浏览文件 @
005115a1
metal/MobileNetDemo/MobileNetDemo/MobileNet.swift
浏览文件 @
005115a1
metal/MobileNetDemo/MobileNetDemo/MobilenetPreProcess.metal
浏览文件 @
005115a1
metal/MobileNetDemo/MobileNetDemo/ViewController.swift
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/AppDelegate.swift
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard
浏览文件 @
005115a1
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"14460.31"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
initialViewController=
"
4MS-jc-i6A
"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"14460.31"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
initialViewController=
"
BYZ-38-t0r
"
>
<device
id=
"retina4_7"
orientation=
"portrait"
>
<adaptation
id=
"fullscreen"
/>
</device>
...
...
metal/paddle-mobile-demo/paddle-mobile-demo/MetalHelper.swift
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/MultiPredictViewController.swift
浏览文件 @
005115a1
...
...
@@ -30,37 +30,37 @@ class MultiPredictViewController: UIViewController {
@IBAction
func
predictAct
(
_
sender
:
Any
)
{
let
success
=
self
.
runner2
.
load
()
// DispatchQueue.global().async {
// DispatchQueue.global().async {
let
image1
=
UIImage
.
init
(
named
:
"hand.jpg"
)
// let success = self.runner2.load()
// if success {
// for i in 0..<10000 {
// print(i)
// self.runner2.predict(cgImage: image1!.cgImage!, completion: { (success, res) in
// print("result1: ")
//// print(res)
// })
// }
// } else {
// print("load failed")
// }
// self.runner1.clear()
// }
// return
// DispatchQueue.global().async {
//// sleep(1)
// let image1 = UIImage.init(named: "banana.jpeg")
//// if success {
// for _ in 0..<10 {
// self.runner2.predict(cgImage: image1!.cgImage!, completion: { (success, res) in
// print("result2: ")
// print(res)
// })
// }
//// } else {
//// print("load failed")
//// }
//// self.runner2.clear()
// }
// let success = self.runner2.load()
// if success {
// for i in 0..<10000 {
// print(i)
// self.runner2.predict(cgImage: image1!.cgImage!, completion: { (success, res) in
// print("result1: ")
//// print(res)
// })
// }
// } else {
// print("load failed")
// }
// self.runner1.clear()
// }
// return
// DispatchQueue.global().async {
//// sleep(1)
// let image1 = UIImage.init(named: "banana.jpeg")
//// if success {
// for _ in 0..<10 {
// self.runner2.predict(cgImage: image1!.cgImage!, completion: { (success, res) in
// print("result2: ")
// print(res)
// })
// }
//// } else {
//// print("load failed")
//// }
//// self.runner2.clear()
// }
}
}
metal/paddle-mobile-demo/paddle-mobile-demo/Net/CPUCompute.mm
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/Net/Genet.swift
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/Net/MobileNet.swift
浏览文件 @
005115a1
...
...
@@ -57,8 +57,8 @@ public class MobileNet: Net{
except
=
0
modelPath
=
Bundle
.
main
.
path
(
forResource
:
"mobilenet_model"
,
ofType
:
nil
)
?
!
"model null"
paramPath
=
Bundle
.
main
.
path
(
forResource
:
"mobilenet_params"
,
ofType
:
nil
)
?
!
"para null"
// metalLoadMode = .LoadMetalInCustomMetalLib
// metalLibPath = Bundle.main.path(forResource: "PaddleMobileMetal", ofType: "metallib") ?! " can't be nil "
// metalLoadMode = .LoadMetalInCustomMetalLib
// metalLibPath = Bundle.main.path(forResource: "PaddleMobileMetal", ofType: "metallib") ?! " can't be nil "
preprocessKernel
=
MobilenetPreProccess
.
init
(
device
:
device
)
inputDim
=
Dim
.
init
(
inDim
:
[
1
,
224
,
224
,
3
])
metalLoadMode
=
.
LoadMetalInCustomMetalLib
...
...
metal/paddle-mobile-demo/paddle-mobile-demo/Net/MobileNetCombined.swift
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/Net/MobileNetSSD.swift
浏览文件 @
005115a1
...
...
@@ -51,45 +51,45 @@ public class MobileNet_ssd_hand: Net {
override
public
func
fetchResult
(
paddleMobileRes
:
[
GPUResultHolder
])
->
[
ResultHolder
]
{
// guard let interRes = paddleMobileRes.intermediateResults else {
// fatalError(" need have inter result ")
// }
//
// guard let scores = interRes["Scores"], scores.count > 0, let score = scores[0] as? Texture<Float32> else {
// fatalError(" need score ")
// }
//
// guard let bboxs = interRes["BBoxes"], bboxs.count > 0, let bbox = bboxs[0] as? Texture<Float32> else {
// fatalError()
// }
//
// var scoreFormatArr: [Float32] = score.metalTexture.realNHWC(dim: (n: score.padToFourDim[0], h: score.padToFourDim[1], w: score.padToFourDim[2], c: score.padToFourDim[3]))
//// print("score: ")
//// print(scoreFormatArr.strideArray())
////
// var bboxArr = bbox.metalTexture.float32Array()
//// print("bbox: ")
//// print(bboxArr.strideArray())
//
// let nmsCompute = NMSCompute.init()
// nmsCompute.scoreThredshold = 0.01
// nmsCompute.nmsTopK = 400
// nmsCompute.keepTopK = 200
// nmsCompute.nmsEta = 1.0
// nmsCompute.nmsThreshold = 0.45
// nmsCompute.background_label = 0;
//
// nmsCompute.scoreDim = [NSNumber.init(value: score.tensorDim[0]), NSNumber.init(value: score.tensorDim[1]), NSNumber.init(value: score.tensorDim[2])]
//
// nmsCompute.bboxDim = [NSNumber.init(value: bbox.tensorDim[0]), NSNumber.init(value: bbox.tensorDim[1]), NSNumber.init(value: bbox.tensorDim[2])]
// guard let result = nmsCompute.compute(withScore: &scoreFormatArr, andBBoxs: &bboxArr) else {
// fatalError( " result error " )
// }
//
// let output: [Float32] = result.map { $0.floatValue }
//
//
// return output
// guard let interRes = paddleMobileRes.intermediateResults else {
// fatalError(" need have inter result ")
// }
//
// guard let scores = interRes["Scores"], scores.count > 0, let score = scores[0] as? Texture<Float32> else {
// fatalError(" need score ")
// }
//
// guard let bboxs = interRes["BBoxes"], bboxs.count > 0, let bbox = bboxs[0] as? Texture<Float32> else {
// fatalError()
// }
//
// var scoreFormatArr: [Float32] = score.metalTexture.realNHWC(dim: (n: score.padToFourDim[0], h: score.padToFourDim[1], w: score.padToFourDim[2], c: score.padToFourDim[3]))
//// print("score: ")
//// print(scoreFormatArr.strideArray())
////
// var bboxArr = bbox.metalTexture.float32Array()
//// print("bbox: ")
//// print(bboxArr.strideArray())
//
// let nmsCompute = NMSCompute.init()
// nmsCompute.scoreThredshold = 0.01
// nmsCompute.nmsTopK = 400
// nmsCompute.keepTopK = 200
// nmsCompute.nmsEta = 1.0
// nmsCompute.nmsThreshold = 0.45
// nmsCompute.background_label = 0;
//
// nmsCompute.scoreDim = [NSNumber.init(value: score.tensorDim[0]), NSNumber.init(value: score.tensorDim[1]), NSNumber.init(value: score.tensorDim[2])]
//
// nmsCompute.bboxDim = [NSNumber.init(value: bbox.tensorDim[0]), NSNumber.init(value: bbox.tensorDim[1]), NSNumber.init(value: bbox.tensorDim[2])]
// guard let result = nmsCompute.compute(withScore: &scoreFormatArr, andBBoxs: &bboxArr) else {
// fatalError( " result error " )
// }
//
// let output: [Float32] = result.map { $0.floatValue }
//
//
// return output
fatalError
()
}
...
...
metal/paddle-mobile-demo/paddle-mobile-demo/Net/MobilenetSSD_AR.swift
浏览文件 @
005115a1
...
...
@@ -49,104 +49,104 @@ public class MobileNet_ssd_AR: Net {
override
public
func
fetchResult
(
paddleMobileRes
:
[
GPUResultHolder
])
->
[
ResultHolder
]
{
fatalError
()
// guard let interRes = paddleMobileRes.intermediateResults else {
// fatalError(" need have inter result ")
// }
//
// guard let scores = interRes["Scores"], scores.count > 0, let score = scores[0] as? FetchHolder else {
// fatalError(" need score ")
// }
//
// guard let bboxs = interRes["BBoxes"], bboxs.count > 0, let bbox = bboxs[0] as? FetchHolder else {
// fatalError()
// }
// let startDate = Date.init()
// print("scoreFormatArr: ")
//print((0..<score.capacity).map{ score.result[$0] }.strideArray())
//
// print("bbox arr: ")
//
// print((0..<bbox.capacity).map{ bbox.result[$0] }.strideArray())
// let nmsCompute = NMSCompute.init()
// nmsCompute.scoreThredshold = 0.25
// nmsCompute.nmsTopK = 100
// nmsCompute.keepTopK = 100
// nmsCompute.nmsEta = 1.0
// nmsCompute.nmsThreshold = 0.449999988
// nmsCompute.background_label = 0;
// nmsCompute.scoreDim = [NSNumber.init(value: score.dim[0]), NSNumber.init(value: score.dim[1]), NSNumber.init(value: score.dim[2])]
// nmsCompute.bboxDim = [NSNumber.init(value: bbox.dim[0]), NSNumber.init(value: bbox.dim[1]), NSNumber.init(value: bbox.dim[2])]
// guard let result = nmsCompute.compute(withScore: score.result, andBBoxs: bbox.result) else {
// fatalError( " result error " )
// }
// let resultHolder = ResultHolder.init(inResult: result.output, inCapacity: Int(result.outputSize))
// for i in 0..<Int(result.outputSize) {
//
// print("i \(i) : \(result.output[i])")
// }
// print(Date.init().timeIntervalSince(startDate))
// print(resultHolder.result![0])
// return resultHolder
// guard let interRes = paddleMobileRes.intermediateResults else {
// fatalError(" need have inter result ")
// }
//
// guard let scores = interRes["Scores"], scores.count > 0, let score = scores[0] as? FetchHolder else {
// fatalError(" need score ")
// }
//
// guard let bboxs = interRes["BBoxes"], bboxs.count > 0, let bbox = bboxs[0] as? FetchHolder else {
// fatalError()
// }
// let startDate = Date.init()
// print("scoreFormatArr: ")
//print((0..<score.capacity).map{ score.result[$0] }.strideArray())
//
// print("bbox arr: ")
//
// print((0..<bbox.capacity).map{ bbox.result[$0] }.strideArray())
// let nmsCompute = NMSCompute.init()
// nmsCompute.scoreThredshold = 0.25
// nmsCompute.nmsTopK = 100
// nmsCompute.keepTopK = 100
// nmsCompute.nmsEta = 1.0
// nmsCompute.nmsThreshold = 0.449999988
// nmsCompute.background_label = 0;
// nmsCompute.scoreDim = [NSNumber.init(value: score.dim[0]), NSNumber.init(value: score.dim[1]), NSNumber.init(value: score.dim[2])]
// nmsCompute.bboxDim = [NSNumber.init(value: bbox.dim[0]), NSNumber.init(value: bbox.dim[1]), NSNumber.init(value: bbox.dim[2])]
// guard let result = nmsCompute.compute(withScore: score.result, andBBoxs: bbox.result) else {
// fatalError( " result error " )
// }
// let resultHolder = ResultHolder.init(inResult: result.output, inCapacity: Int(result.outputSize))
// for i in 0..<Int(result.outputSize) {
//
// print("i \(i) : \(result.output[i])")
// }
// print(Date.init().timeIntervalSince(startDate))
// print(resultHolder.result![0])
// return resultHolder
}
// override func updateProgram(program: Program) {
// for i in [56, 66, 76, 86, 93, 99] {
// let opDesc = program.programDesc.blocks[0].ops[i]
// let output = opDesc.outputs["Out"]!.first!
// let v = program.scope[output]!
// let originTexture = v as! Texture
// originTexture.tensorDim = Dim.init(inDim: [originTexture.tensorDim[1] / 7, originTexture.tensorDim[0] * 7])
//
// originTexture.dim = Dim.init(inDim: [1, 1, originTexture.dim[3] / 7, originTexture.dim[2] * 7])
//
// originTexture.padToFourDim = Dim.init(inDim: [1, 1, originTexture.padToFourDim[3] / 7, originTexture.padToFourDim[2] * 7])
//
// program.scope[output] = originTexture
//
// if i == 99 {
// opDesc.attrs["axis"] = 0
// } else {
// opDesc.attrs["shape"] = originTexture.tensorDim.dims.map { Int32($0) }
// }
// }
//
// for i in [58, 59, 88, 89, 95, 96, 68, 69, 78, 79] {
// let opDesc = program.programDesc.blocks[0].ops[i]
// let output = opDesc.outputs["Out"]!.first!
// let v = program.scope[output]!
//
//
//
// let originTexture = v as! Texture
// originTexture.tensorDim = Dim.init(inDim: [originTexture.tensorDim[1], originTexture.tensorDim[2]])
// opDesc.attrs["shape"] = originTexture.tensorDim.dims.map { Int32($0) }
// }
//
// for i in [60, 101, 90, 97, 70, 80] {
// let opDesc = program.programDesc.blocks[0].ops[i]
// let output = opDesc.outputs["Out"]!.first!
// let v = program.scope[output]!
// let originTexture = v as! Texture
// originTexture.tensorDim = Dim.init(inDim: [originTexture.tensorDim[1], originTexture.tensorDim[2]])
// opDesc.attrs["axis"] = (opDesc.attrs["axis"]! as! Int) - 1
// }
//
// for i in [102] {
// let opDesc = program.programDesc.blocks[0].ops[i]
// for output in opDesc.outputs["Out"]! {
// let v = program.scope[output]!
// let originTexture = v as! Texture
// originTexture.tensorDim = Dim.init(inDim: [originTexture.tensorDim[1], originTexture.tensorDim[2]])
// }
// opDesc.attrs["axis"] = (opDesc.attrs["axis"]! as! Int) - 1
// print(" split axis \(opDesc.attrs["axis"])")
// }
// override func updateProgram(program: Program) {
// for i in [56, 66, 76, 86, 93, 99] {
// let opDesc = program.programDesc.blocks[0].ops[i]
// let output = opDesc.outputs["Out"]!.first!
// let v = program.scope[output]!
// let originTexture = v as! Texture
// originTexture.tensorDim = Dim.init(inDim: [originTexture.tensorDim[1] / 7, originTexture.tensorDim[0] * 7])
//
// originTexture.dim = Dim.init(inDim: [1, 1, originTexture.dim[3] / 7, originTexture.dim[2] * 7])
//
// originTexture.padToFourDim = Dim.init(inDim: [1, 1, originTexture.padToFourDim[3] / 7, originTexture.padToFourDim[2] * 7])
//
// program.scope[output] = originTexture
//
// if i == 99 {
// opDesc.attrs["axis"] = 0
// } else {
// opDesc.attrs["shape"] = originTexture.tensorDim.dims.map { Int32($0) }
// }
// }
//
// for i in [58, 59, 88, 89, 95, 96, 68, 69, 78, 79] {
// let opDesc = program.programDesc.blocks[0].ops[i]
// let output = opDesc.outputs["Out"]!.first!
// let v = program.scope[output]!
//
//
//
// let originTexture = v as! Texture
// originTexture.tensorDim = Dim.init(inDim: [originTexture.tensorDim[1], originTexture.tensorDim[2]])
// opDesc.attrs["shape"] = originTexture.tensorDim.dims.map { Int32($0) }
// }
//
// for i in [60, 101, 90, 97, 70, 80] {
// let opDesc = program.programDesc.blocks[0].ops[i]
// let output = opDesc.outputs["Out"]!.first!
// let v = program.scope[output]!
// let originTexture = v as! Texture
// originTexture.tensorDim = Dim.init(inDim: [originTexture.tensorDim[1], originTexture.tensorDim[2]])
// opDesc.attrs["axis"] = (opDesc.attrs["axis"]! as! Int) - 1
// }
//
// for i in [102] {
// let opDesc = program.programDesc.blocks[0].ops[i]
// for output in opDesc.outputs["Out"]! {
// let v = program.scope[output]!
// let originTexture = v as! Texture
// originTexture.tensorDim = Dim.init(inDim: [originTexture.tensorDim[1], originTexture.tensorDim[2]])
// }
// opDesc.attrs["axis"] = (opDesc.attrs["axis"]! as! Int) - 1
// print(" split axis \(opDesc.attrs["axis"])")
// }
// 99
// }
// }
}
metal/paddle-mobile-demo/paddle-mobile-demo/Net/PreProcessKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/Net/YoloNet.swift
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/OCDemo/LoadPointerViewController.m
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/OCInterface/PaddleMobileGPU.h
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/OCInterface/PaddleMobileGPU.m
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/OCInterface/SuperResolutionNet.swift
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/VideoCapture/FPSCounter.swift
浏览文件 @
005115a1
metal/paddle-mobile-demo/paddle-mobile-demo/VideoCapture/VideoCapture.swift
浏览文件 @
005115a1
...
...
@@ -14,7 +14,7 @@ import AVFoundation
/**
Simple interface to the iPhone's camera.
*/
*/
@available
(
iOS
10.0
,
*
)
public
class
VideoCapture
:
NSObject
{
public
var
previewLayer
:
AVCaptureVideoPreviewLayer
?
...
...
metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift
浏览文件 @
005115a1
...
...
@@ -89,21 +89,21 @@ class ViewController: UIViewController {
@IBAction
func
loadAct
(
_
sender
:
Any
)
{
runner
=
Runner
.
init
(
inNet
:
netSupport
[
modelType
]
!
,
commandQueue
:
MetalHelper
.
shared
.
queue
)
if
platform
==
.
GPU
{
// let filePath = Bundle.main.path(forResource: "mingren_input_data", ofType: nil)
// let fileReader = try! FileReader.init(paramPath: filePath!)
// let pointer: UnsafeMutablePointer<Float32> = fileReader.read()
//
//
// let buffer = MetalHelper.shared.device.makeBuffer(length: fileReader.fileSize, options: .storageModeShared)
//
// buffer?.contents().copyMemory(from: pointer, byteCount: fileReader.fileSize)
// let filePath = Bundle.main.path(forResource: "mingren_input_data", ofType: nil)
// let fileReader = try! FileReader.init(paramPath: filePath!)
// let pointer: UnsafeMutablePointer<Float32> = fileReader.read()
//
//
// let buffer = MetalHelper.shared.device.makeBuffer(length: fileReader.fileSize, options: .storageModeShared)
//
// buffer?.contents().copyMemory(from: pointer, byteCount: fileReader.fileSize)
if
self
.
toPredictTexture
==
nil
{
// runner.getTexture(inBuffer: buffer!) { [weak self] (texture) in
// self?.toPredictTexture = texture
// }
// runner.getTexture(inBuffer: buffer!) { [weak self] (texture) in
// self?.toPredictTexture = texture
// }
runner
.
getTexture
(
image
:
selectImage
!.
cgImage
!
)
{
[
weak
self
]
(
texture
)
in
self
?
.
toPredictTexture
=
texture
...
...
@@ -171,42 +171,19 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
GlobalConfig
.
shared
.
computePrecision
=
.
Float16
GlobalConfig
.
shared
.
debug
=
false
modelPickerView
.
delegate
=
self
modelPickerView
.
dataSource
=
self
threadPickerView
.
delegate
=
self
threadPickerView
.
dataSource
=
self
if
let
image
=
UIImage
.
init
(
named
:
"classify-img-output.pn
g"
)
{
if
let
image
=
UIImage
.
init
(
named
:
"00001.jp
g"
)
{
selectImage
=
image
selectImageView
.
image
=
image
}
else
{
print
(
"请添加测试图片"
)
}
GlobalConfig
.
shared
.
computePrecision
=
.
Float32
// if platform == .CPU {
// inputPointer = runner.preproccess(image: selectImage!.cgImage!)
// } else if platform == .GPU {
// runner.getTexture(image: selectImage!.cgImage!) {[weak self] (texture) in
// self?.toPredictTexture = texture
// }
// } else {
// fatalError( " unsupport " )
// }
// videoCapture = VideoCapture.init(device: MetalHelper.shared.device, orientation: .portrait, position: .back)
// videoCapture.fps = 30
// videoCapture.delegate = self
// videoCapture.setUp { (success) in
// DispatchQueue.main.async {
// if let preViewLayer = self.videoCapture.previewLayer {
// self.videoView.layer.addSublayer(preViewLayer)
// self.videoCapture.previewLayer?.frame = self.videoView.bounds
// }
// self.videoCapture.start()
// }
// }
}
}
...
...
metal/paddle-mobile-metallib/paddle-mobile-metallib.xcodeproj/project.pbxproj
浏览文件 @
005115a1
...
...
@@ -326,9 +326,10 @@
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ALWAYS_SEARCH_USER_PATHS
=
NO
;
IPHONEOS_DEPLOYMENT_TARGET
=
12.1
;
IPHONEOS_DEPLOYMENT_TARGET
=
9.0
;
MTL_ENABLE_DEBUG_INFO
=
INCLUDE_SOURCE
;
MTL_FAST_MATH
=
YES
;
MTL_LANGUAGE_REVISION
=
Metal12
;
SDKROOT
=
iphoneos
;
};
name
=
Debug
;
...
...
@@ -337,9 +338,10 @@
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ALWAYS_SEARCH_USER_PATHS
=
NO
;
IPHONEOS_DEPLOYMENT_TARGET
=
12.1
;
IPHONEOS_DEPLOYMENT_TARGET
=
9.0
;
MTL_ENABLE_DEBUG_INFO
=
NO
;
MTL_FAST_MATH
=
YES
;
MTL_LANGUAGE_REVISION
=
Metal12
;
SDKROOT
=
iphoneos
;
};
name
=
Release
;
...
...
metal/paddle-mobile-metallib/paddle-mobile-metallib/BatchNormKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/BatchNormRelu.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/BilinearInterp.inc.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/BilinearInterp.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/BoxCoder.inc.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/BufferToTexture.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/Common.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConcatKernel.inc.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConcatKernel.metal
浏览文件 @
005115a1
...
...
@@ -41,129 +41,129 @@ struct ConcatParam {
// ssd-ar: (R=3, N=5, V=x)
#define V VX
#define R 3
#define N 5
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#define R 3
#define N 5
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#undef V
// ssd-ar: (R=2, N=5, V=x)
#define V VX
#define R 2
#define N 5
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#define R 2
#define N 5
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#undef V
// ssd-ar: (R=3, N=2, V=y)
#define V VY
#define R 3
#define N 2
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#define R 3
#define N 2
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#undef V
// ssd-ar: (R=4, N=3, V=z)
#define V VZ
#define R 4
#define N 3
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#define R 4
#define N 3
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#undef V
// ssd: (R=2, N=6, V=y)
#define V VY
#define R 2
#define N 6
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#define R 2
#define N 6
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#undef V
// ssd: (R=3, N=6, V=y)
#define V VY
#define R 3
#define N 6
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#define R 3
#define N 6
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#undef V
#define V VNORMAL
#define R 4
#define N 2
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#define R 4
#define N 2
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#undef V
#define V VY
#define R 2
#define N 2
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#define R 2
#define N 2
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#undef V
#define V VY
#define R 2
#define N 5
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#define R 2
#define N 5
#define P float
#include "ConcatKernel.inc.metal"
#undef P
#define P half
#include "ConcatKernel.inc.metal"
#undef P
#undef N
#undef R
#undef V
...
...
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvAddBNReluKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvAddMetal.metal
浏览文件 @
005115a1
...
...
@@ -57,7 +57,7 @@ kernel void conv_add_1x1(texture2d_array<float, access::sample> inTexture [[text
float4 weight_w = weights[weithTo + 3 * kernelHXW * input_arr_size + i];
output.w += dot(input, weight_w);
}
// output = output + biase[gid.z];
// output = output + biase[gid.z];
outTexture.write(output, gid.xy, gid.z);
}
...
...
@@ -125,7 +125,7 @@ kernel void conv_add_3x3(texture2d_array<float, access::sample> inTexture [[text
output.w += dot(input[j], weight_w);
}
}
// output = output + biase[gid.z];
// output = output + biase[gid.z];
outTexture.write(output, gid.xy, gid.z);
}
...
...
@@ -183,7 +183,7 @@ kernel void conv_add_5x1(texture2d_array<float, access::sample> inTexture [[text
output.w += dot(input[j], weight_w);
}
}
// output = output + biase[gid.z];
// output = output + biase[gid.z];
outTexture.write(output, gid.xy, gid.z);
}
...
...
@@ -242,7 +242,7 @@ kernel void conv_add_1x5(texture2d_array<float, access::sample> inTexture [[text
output.w += dot(input[j], weight_w);
}
}
// output = output + biase[gid.z];
// output = output + biase[gid.z];
outTexture.write(output, gid.xy, gid.z);
}
...
...
@@ -283,7 +283,7 @@ kernel void depthwise_conv_add_3x3(texture2d_array<float, access::sample> inText
output.z += input.z * weights[weithTo + 2 * kernelHXW + j];
output.w += input.w * weights[weithTo + 3 * kernelHXW + j];
}
// output = output + biase[gid.z];
// output = output + biase[gid.z];
outTexture.write(output, gid.xy, gid.z);
}
...
...
@@ -312,25 +312,25 @@ kernel void conv_add_1x1_half(texture2d_array<half, access::sample> inTexture [[
uint input_arr_size = inTexture.get_array_size();
uint weithTo = gid.z * kernelHXW * input_arr_size * 4;
half4 output = biase[gid.z]
;
float4 output = float4(biase[gid.z])
;
half
4 input;
float
4 input;
for (uint i = 0; i < input_arr_size; ++i) {
input = inTexture.sample(sample, float2(posInInput.x, posInInput.y), i
);
half4 weight_x = weights[weithTo + 0 * kernelHXW * input_arr_size + i]
;
input = float4(inTexture.sample(sample, float2(posInInput.x, posInInput.y), i)
);
float4 weight_x = float4(weights[weithTo + 0 * kernelHXW * input_arr_size + i])
;
output.x += dot(input, weight_x);
half4 weight_y = weights[weithTo + 1 * kernelHXW * input_arr_size + i]
;
float4 weight_y = float4(weights[weithTo + 1 * kernelHXW * input_arr_size + i])
;
output.y += dot(input, weight_y);
half4 weight_z = weights[weithTo + 2 * kernelHXW * input_arr_size + i]
;
float4 weight_z = float4(weights[weithTo + 2 * kernelHXW * input_arr_size + i])
;
output.z += dot(input, weight_z);
half4 weight_w = weights[weithTo + 3 * kernelHXW * input_arr_size + i]
;
float4 weight_w = float4(weights[weithTo + 3 * kernelHXW * input_arr_size + i])
;
output.w += dot(input, weight_w);
}
// output = output + float4(biase[gid.z]);
outTexture.write(output
, gid.xy, gid.z);
// output = output + float4(biase[gid.z]);
outTexture.write(half4(output)
, gid.xy, gid.z);
}
kernel void conv_add_3x3_half(texture2d_array<half, access::sample> inTexture [[texture(0)]],
...
...
@@ -384,7 +384,7 @@ kernel void conv_add_3x3_half(texture2d_array<half, access::sample> inTexture [[
output.w += dot(float4(input[j]), float4(weight_w));
}
}
// output = output + float4(biase[gid.z]);
// output = output + float4(biase[gid.z]);
outTexture.write(output, gid.xy, gid.z);
}
...
...
@@ -424,7 +424,7 @@ kernel void depthwise_conv_add_3x3_half(texture2d_array<half, access::sample> in
output.z += input.z * weights[weithTo + 2 * kernelHXW + j];
output.w += input.w * weights[weithTo + 3 * kernelHXW + j];
}
// output = output + float4(biase[gid.z]);
// output = output + float4(biase[gid.z]);
outTexture.write(output, gid.xy, gid.z);
}
...
...
@@ -483,7 +483,7 @@ kernel void conv_add_5x1_half(texture2d_array<half, access::sample> inTexture [[
output.w += dot(input[j], weight_w);
}
}
// output = output + float4(biase[gid.z]);
// output = output + float4(biase[gid.z]);
outTexture.write(output, gid.xy, gid.z);
}
...
...
@@ -542,7 +542,7 @@ kernel void conv_add_1x5_half(texture2d_array<half, access::sample> inTexture [[
output.w += dot(input[j], weight_w);
}
}
// output = output + float4(biase[gid.z]);
// output = output + float4(biase[gid.z]);
outTexture.write(output, gid.xy, gid.z);
}
...
...
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvAddPrelu.inc.metal
浏览文件 @
005115a1
...
...
@@ -67,7 +67,7 @@ kernel void FUNC3_(conv_add_1x1, PRELU_TYPE, P)(texture2d_array<P, access::sampl
output.w += dot(input, weight_w);
}
// output = output + float4(biase[gid.z]);
// output = output + float4(biase[gid.z]);
#ifdef PRELU_CHANNEL
VECTOR(P, 4) alpha_value = alpha[gid.z];
...
...
@@ -166,7 +166,7 @@ kernel void FUNC3_(conv_add_3x3, PRELU_TYPE, P)(texture2d_array<P, access::sampl
output.w += dot(input[j], weight_w);
}
}
// output = output + float4(biase[gid.z]);
// output = output + float4(biase[gid.z]);
#ifdef PRELU_CHANNEL
VECTOR(P, 4) alpha_value = alpha[gid.z];
...
...
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvAddPreluKernel.metal
浏览文件 @
005115a1
...
...
@@ -18,45 +18,45 @@ using namespace metal;
#define P float
#define PRELU_CHANNEL prelu_channel
#define PRELU_TYPE prelu_channel
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_CHANNEL
#define PRELU_ELEMENT prelu_element
#define PRELU_TYPE prelu_element
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_ELEMENT
#define PRELU_OTHER prelu_other
#define PRELU_TYPE prelu_other
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_OTHER
#define PRELU_CHANNEL prelu_channel
#define PRELU_TYPE prelu_channel
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_CHANNEL
#define PRELU_ELEMENT prelu_element
#define PRELU_TYPE prelu_element
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_ELEMENT
#define PRELU_OTHER prelu_other
#define PRELU_TYPE prelu_other
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_OTHER
#undef P
#define P half
#define PRELU_CHANNEL prelu_channel
#define PRELU_TYPE prelu_channel
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_CHANNEL
#define PRELU_ELEMENT prelu_element
#define PRELU_TYPE prelu_element
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_ELEMENT
#define PRELU_OTHER prelu_other
#define PRELU_TYPE prelu_other
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_OTHER
#define PRELU_CHANNEL prelu_channel
#define PRELU_TYPE prelu_channel
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_CHANNEL
#define PRELU_ELEMENT prelu_element
#define PRELU_TYPE prelu_element
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_ELEMENT
#define PRELU_OTHER prelu_other
#define PRELU_TYPE prelu_other
#include "ConvAddPrelu.inc.metal"
#undef PRELU_TYPE
#undef PRELU_OTHER
#undef P
...
...
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvBNReluKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ConvTransposeKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/Elementwise.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ElementwiseAddPreluKernel.inc.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ElementwiseAddPreluKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/FetchKernel.inc.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/FetchKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/Kernels.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/NMSFetchResultKernel.metal
浏览文件 @
005115a1
...
...
@@ -58,7 +58,7 @@ kernel void nms_fetch_bbox(texture2d_array<float, access::read> inTexture [[text
}
int input_width = inTexture.get_width();
// int input_height = inTexture.get_height();
// int input_height = inTexture.get_height();
const float4 input = inTexture.read(gid.xy, gid.z);
output[gid.y * input_width + gid.x] = input;
}
...
...
@@ -73,7 +73,7 @@ kernel void nms_fetch_bbox_half(texture2d_array<half, access::read> inTexture [[
}
int input_width = inTexture.get_width();
// int input_height = inTexture.get_height();
// int input_height = inTexture.get_height();
const half4 input = inTexture.read(gid.xy, gid.z);
output[gid.y * input_width + gid.x] = float4(input);
}
...
...
metal/paddle-mobile-metallib/paddle-mobile-metallib/PoolKernel.inc.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/PoolKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/PreluKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/PriorBoxKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ReluKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ReshapeKernel.inc.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ReshapeKernel.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/ResizeBilinear.metal
浏览文件 @
005115a1
...
...
@@ -16,8 +16,8 @@
using namespace metal;
struct resize_bilinear_param {
// int32_t out_h;
// int32_t out_w;
// int32_t out_h;
// int32_t out_w;
float ratio_h;
float ratio_w;
};
...
...
metal/paddle-mobile-metallib/paddle-mobile-metallib/Scale.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/Softmax.inc.metal
浏览文件 @
005115a1
...
...
@@ -27,7 +27,7 @@ kernel void FUNC(softmax, P)(texture2d_array<P, access::read> inTexture [[textur
if (gid.x >= outTexture.get_width() ||
gid.y >= outTexture.get_height() ||
gid.z >= outTexture.get_array_size()) return;
// int zsize = inTexture.get_array_size();
// int zsize = inTexture.get_array_size();
P maxv = inTexture.read(uint2(0, gid.y), 0)[0];
int group = sp.K / 4;
int remain = sp.K % 4;
...
...
metal/paddle-mobile-metallib/paddle-mobile-metallib/Softmax.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/Split.inc.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/Split.metal
浏览文件 @
005115a1
...
...
@@ -36,29 +36,29 @@ struct SplitParam {
//// ssd-ar: (R=3, N=2, V=y)
#define V VY
#define R 3
#define N 2
#define P float
#include "Split.inc.metal"
#undef P
#define P half
#include "Split.inc.metal"
#undef P
#undef N
#undef R
#define R 3
#define N 2
#define P float
#include "Split.inc.metal"
#undef P
#define P half
#include "Split.inc.metal"
#undef P
#undef N
#undef R
#undef V
//// ssd-ar: (R=2, N=2, V=y)
#define V VY
#define R 2
#define N 2
#define P float
#include "Split.inc.metal"
#undef P
#define P half
#include "Split.inc.metal"
#undef P
#undef N
#undef R
#define R 2
#define N 2
#define P float
#include "Split.inc.metal"
#undef P
#define P half
#include "Split.inc.metal"
#undef P
#undef N
#undef R
#undef V
metal/paddle-mobile-metallib/paddle-mobile-metallib/TransposeKernel.inc.metal
浏览文件 @
005115a1
metal/paddle-mobile-metallib/paddle-mobile-metallib/TransposeKernel.metal
浏览文件 @
005115a1
...
...
@@ -36,28 +36,28 @@ kernel void transpose_copy_half(texture2d_array<half, access::read> inTexture [[
}
#define R 4
#define P float
#include "TransposeKernel.inc.metal"
#undef P
#define P half
#include "TransposeKernel.inc.metal"
#undef P
#define P float
#include "TransposeKernel.inc.metal"
#undef P
#define P half
#include "TransposeKernel.inc.metal"
#undef P
#undef R
#define R 3
#define P float
#include "TransposeKernel.inc.metal"
#undef P
#define P half
#include "TransposeKernel.inc.metal"
#undef P
#define P float
#include "TransposeKernel.inc.metal"
#undef P
#define P half
#include "TransposeKernel.inc.metal"
#undef P
#undef R
#define R 2
#define P float
#include "TransposeKernel.inc.metal"
#undef P
#define P half
#include "TransposeKernel.inc.metal"
#undef P
#define P float
#include "TransposeKernel.inc.metal"
#undef P
#define P half
#include "TransposeKernel.inc.metal"
#undef P
#undef R
metal/paddle-mobile-unit-test/paddle-mobile-unit-test/AppDelegate.swift
浏览文件 @
005115a1
metal/paddle-mobile-unit-test/paddle-mobile-unit-test/ViewController.swift
浏览文件 @
005115a1
...
...
@@ -27,8 +27,8 @@ class ViewController: UIViewController {
inQueue
:
queue
)
test
.
testConcat
()
// test.testReshape()
// test.testTranspose()
// test.testReshape()
// test.testTranspose()
print
(
" done "
)
}
...
...
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
浏览文件 @
005115a1
...
...
@@ -741,7 +741,7 @@
CODE_SIGN_IDENTITY
=
"iPhone Developer"
;
CODE_SIGN_STYLE
=
Automatic
;
DEFINES_MODULE
=
YES
;
DEVELOPMENT_TEAM
=
""
;
DEVELOPMENT_TEAM
=
A798K58VVL
;
DYLIB_COMPATIBILITY_VERSION
=
1
;
DYLIB_CURRENT_VERSION
=
1
;
DYLIB_INSTALL_NAME_BASE
=
"@rpath"
;
...
...
@@ -778,7 +778,7 @@
CODE_SIGN_IDENTITY
=
"iPhone Developer"
;
CODE_SIGN_STYLE
=
Automatic
;
DEFINES_MODULE
=
YES
;
DEVELOPMENT_TEAM
=
""
;
DEVELOPMENT_TEAM
=
A798K58VVL
;
DYLIB_COMPATIBILITY_VERSION
=
1
;
DYLIB_CURRENT_VERSION
=
1
;
DYLIB_INSTALL_NAME_BASE
=
"@rpath"
;
...
...
metal/paddle-mobile/paddle-mobile/API/GlobalConfig.swift
浏览文件 @
005115a1
...
...
@@ -35,4 +35,6 @@ import Foundation
/// 运算精度, runner 生命周期中不可变
@objc
public
var
computePrecision
:
ComputePrecision
=
.
Float16
/// 是否开启 log
@objc
public
var
debug
:
Bool
=
true
;
}
metal/paddle-mobile/paddle-mobile/API/Net.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/API/Runner.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Common/Extensions.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Common/MetalExtension.swift
浏览文件 @
005115a1
...
...
@@ -377,8 +377,8 @@ extension MTLComputeCommandEncoder {
let
height
=
computePipline
.
maxTotalThreadsPerThreadgroup
/
width
let
threadsPerGroup
=
MTLSize
.
init
(
width
:
width
,
height
:
height
,
depth
:
1
)
// print(" thread: threads per group: \(threadsPerGroup) ")
// print(" thread: out texture width: \(outTexture.width) , out texture height: \(outTexture.height)")
// print(" thread: threads per group: \(threadsPerGroup) ")
// print(" thread: out texture width: \(outTexture.width) , out texture height: \(outTexture.height)")
let
groupWidth
=
(
outTexture
.
width
+
width
-
1
)
/
width
let
groupHeight
=
(
outTexture
.
height
+
height
-
1
)
/
height
...
...
@@ -547,9 +547,9 @@ public extension MTLTexture {
}
func
realNHWC
(
dim
:
(
n
:
Int
,
h
:
Int
,
w
:
Int
,
c
:
Int
))
->
[
Float32
]
{
// print("origin dim: \(dim)")
// print("texture: ")
// print(self)
// print("origin dim: \(dim)")
// print("texture: ")
// print(self)
var
textureArray
:
[
Float32
]
if
pixelFormat
==
.
rgba32Float
{
...
...
metal/paddle-mobile/paddle-mobile/Src/Common/PaddleMobileUnitTest.swift
浏览文件 @
005115a1
...
...
@@ -89,135 +89,135 @@ public class PaddleMobileUnitTest {
}
public
func
testConcat
()
{
// let buffer = queue.makeCommandBuffer() ?! "buffer is nil"
// var it: [[Float32]] = []
// for _ in 0..<7 {
// it.append((0..<12).map { Float32($0) })
// }
// let input = it.map { device.tensor2texture(value: $0, dim: [3, 4]) }
// let output = device.tensor2texture(value: [Float32](), dim: [3, 28])
//
// let param = ConcatTestParam.init(
// input: input,
// output: output,
// dims: [[3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4]],
// axis: 1,
// odim: [3, 28]
// )
// let concatKernel = ConcatKernel<Float32>.init(device: device, testParam: param)
// concatKernel.test(cmdBuffer: buffer, param: param)
// buffer.addCompletedHandler { (buffer) in
// for i in 0..<it.count {
// let _: Float32? = input[i].logDesc()
// self.tensorPrint(tensor: it[i], dim: [3, 4])
// }
// let _: Float32? = output.logDesc()
// let tx: [Float32] = self.device.texture2tensor(texture: output, dim: [3, 28])
// self.tensorPrint(tensor: tx, dim: [3, 28])
// }
//
// buffer.commit()
// let buffer = queue.makeCommandBuffer() ?! "buffer is nil"
// var it: [[Float32]] = []
// for _ in 0..<7 {
// it.append((0..<12).map { Float32($0) })
// }
// let input = it.map { device.tensor2texture(value: $0, dim: [3, 4]) }
// let output = device.tensor2texture(value: [Float32](), dim: [3, 28])
//
// let param = ConcatTestParam.init(
// input: input,
// output: output,
// dims: [[3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4]],
// axis: 1,
// odim: [3, 28]
// )
// let concatKernel = ConcatKernel<Float32>.init(device: device, testParam: param)
// concatKernel.test(cmdBuffer: buffer, param: param)
// buffer.addCompletedHandler { (buffer) in
// for i in 0..<it.count {
// let _: Float32? = input[i].logDesc()
// self.tensorPrint(tensor: it[i], dim: [3, 4])
// }
// let _: Float32? = output.logDesc()
// let tx: [Float32] = self.device.texture2tensor(texture: output, dim: [3, 28])
// self.tensorPrint(tensor: tx, dim: [3, 28])
// }
//
// buffer.commit()
}
public
func
testReshape
()
{
// let buffer = queue.makeCommandBuffer() ?! "buffer is nil"
// let input: [Float32] = (0..<24).map { Float32($0) }
// let inTexture = device.tensor2texture(value: input, dim: [2, 3, 4])
// let outTexture = device.tensor2texture(value: [Float32](), dim: [4, 6])
// let mp = ReshapeMetalParam.init(
// idim: (1, 2, 3, 4),
// itrans: (0, 1, 2, 3),
// odim: (1, 1, 4, 6),
// otrans: (0, 1, 2, 3)
// )
// let param = ReshapeTestParam.init(
// inputTexture: inTexture,
// outputTexture: outTexture,
// param: mp
// )
// let reshapeKernel = ReshapeKernel<Float32>.init(device: device, testParam: param)
// reshapeKernel.test(commandBuffer: buffer, testParam: param)
// buffer.addCompletedHandler { (buffer) in
// let _: Float32? = inTexture.logDesc()
// let _: Float32? = outTexture.logDesc()
// self.tensorPrint(tensor: input, dim: [2, 3, 4])
// let tx: [Float32] = self.device.texture2tensor(texture: outTexture, dim: [4, 6])
// self.tensorPrint(tensor: tx, dim: [4, 6])
// }
// let input: [Float32] = (0..<24).map { Float32($0) }
// let inTexture = device.tensor2texture(value: input, dim: [2, 3, 4])
// let outTexture = device.tensor2texture(value: [Float32](), dim: [24])
// let mp = ReshapeMetalParam.init(
// idim: (1, 2, 3, 4),
// itrans: (0, 1, 2, 3),
// odim: (1, 1, 1, 24),
// otrans: (0, 1, 2, 3)
// )
// let param = ReshapeTestParam.init(
// inputTexture: inTexture,
// outputTexture: outTexture,
// param: mp
// )
// let reshapeKernel = ReshapeKernel<Float32>.init(device: device, testParam: param)
// reshapeKernel.test(commandBuffer: buffer, testParam: param)
// buffer.addCompletedHandler { (buffer) in
// let _: Float32? = inTexture.logDesc()
// let _: Float32? = outTexture.logDesc()
// self.tensorPrint(tensor: input, dim: [2, 3, 4])
// let tx: [Float32] = self.device.texture2tensor(texture: outTexture, dim: [24])
// self.tensorPrint(tensor: tx, dim: [24])
// }
//
//
// buffer.commit()
// let buffer = queue.makeCommandBuffer() ?! "buffer is nil"
// let input: [Float32] = (0..<24).map { Float32($0) }
// let inTexture = device.tensor2texture(value: input, dim: [2, 3, 4])
// let outTexture = device.tensor2texture(value: [Float32](), dim: [4, 6])
// let mp = ReshapeMetalParam.init(
// idim: (1, 2, 3, 4),
// itrans: (0, 1, 2, 3),
// odim: (1, 1, 4, 6),
// otrans: (0, 1, 2, 3)
// )
// let param = ReshapeTestParam.init(
// inputTexture: inTexture,
// outputTexture: outTexture,
// param: mp
// )
// let reshapeKernel = ReshapeKernel<Float32>.init(device: device, testParam: param)
// reshapeKernel.test(commandBuffer: buffer, testParam: param)
// buffer.addCompletedHandler { (buffer) in
// let _: Float32? = inTexture.logDesc()
// let _: Float32? = outTexture.logDesc()
// self.tensorPrint(tensor: input, dim: [2, 3, 4])
// let tx: [Float32] = self.device.texture2tensor(texture: outTexture, dim: [4, 6])
// self.tensorPrint(tensor: tx, dim: [4, 6])
// }
// let input: [Float32] = (0..<24).map { Float32($0) }
// let inTexture = device.tensor2texture(value: input, dim: [2, 3, 4])
// let outTexture = device.tensor2texture(value: [Float32](), dim: [24])
// let mp = ReshapeMetalParam.init(
// idim: (1, 2, 3, 4),
// itrans: (0, 1, 2, 3),
// odim: (1, 1, 1, 24),
// otrans: (0, 1, 2, 3)
// )
// let param = ReshapeTestParam.init(
// inputTexture: inTexture,
// outputTexture: outTexture,
// param: mp
// )
// let reshapeKernel = ReshapeKernel<Float32>.init(device: device, testParam: param)
// reshapeKernel.test(commandBuffer: buffer, testParam: param)
// buffer.addCompletedHandler { (buffer) in
// let _: Float32? = inTexture.logDesc()
// let _: Float32? = outTexture.logDesc()
// self.tensorPrint(tensor: input, dim: [2, 3, 4])
// let tx: [Float32] = self.device.texture2tensor(texture: outTexture, dim: [24])
// self.tensorPrint(tensor: tx, dim: [24])
// }
//
//
// buffer.commit()
}
public
func
testTranspose
()
{
let
buffer
=
queue
.
makeCommandBuffer
()
?
!
"buffer is nil"
// var input: [Float32] = []
// for i in 0..<72 {
// input.append(Float32(i))
// }
//// let inputTexture = device.makeFloatTexture(value: input, textureWidth: 3, textureHeight: 2, arrayLength: 3)
// let inputTexture = device.tensor2texture(value: input, dim: [4, 3, 2, 3]);
// // group 1
// let outputTexture = device.tensor2texture(value: [Float32](), dim: [3, 3, 2, 4])
// let param = TransposeTestParam.init(inputTexture: inputTexture, outputTexture: outputTexture, iC: 3, oC: 4, axis: [3, 1, 2, 0])
//// let param = TransposeTestParam.init(inputTexture: inputTexture, outputTexture: outputTexture, iC: 4, oC: 2, axis: [3, 0, 2, 1])
//// // group 2
//// let outputTexture = device.makeFloatTexture(value: [Float32](), textureWidth: 3, textureHeight: 3, arrayLength: 6)
//// let param = TransposeTestParam.init(inputTexture: inputTexture, outputTexture: outputTexture, iC: 4, oC: 4, axis: [3, 0, 2, 1])
////
// let transposeKernel = TransposeKernel<Float32>.init(device: device, testParam: param)
//
// transposeKernel.test(commandBuffer: buffer, param: param)
//
// buffer.addCompletedHandler { (buffer) in
// let _: Float32? = inputTexture.logDesc(header: "input texture", stridable: false)
// let _: Float32? = outputTexture.logDesc(header: "output texture", stridable: false)
// self.tensorPrint(tensor: input, dim: [4, 3, 2, 3])
// let tx: [Float32] = self.device.texture2tensor(texture: outputTexture, dim: [3, 3, 2, 4])
// self.tensorPrint(tensor: tx, dim: [3, 3, 2, 4])
// }
//
// let input: [Float32] = (0..<24).map { Float32($0) }
// let inputTexture = device.tensor2texture(value: input, dim: [2, 3, 4])
// let outputTexture = device.tensor2texture(value: [Float](), dim: [3, 4, 2])
// let param = TransposeTestParam.init(inputTexture: inputTexture, outputTexture: outputTexture, iC: 4, oC: 2, axis: [0, 2, 3, 1])
// let transposeKernel = TransposeKernel<Float32>.init(device: device, testParam: param)
//
// transposeKernel.test(commandBuffer: buffer, param: param)
//
// buffer.addCompletedHandler { (buffer) in
// let _: Float32? = inputTexture.logDesc(header: "input texture", stridable: false)
// let _: Float32? = outputTexture.logDesc(header: "output texture", stridable: false)
// self.tensorPrint(tensor: input, dim: [2, 3, 4])
// let tx: [Float32] = self.device.texture2tensor(texture: outputTexture, dim: [3, 4, 2])
// self.tensorPrint(tensor: tx, dim: [3, 4, 2])
// }
//
// var input: [Float32] = []
// for i in 0..<72 {
// input.append(Float32(i))
// }
//// let inputTexture = device.makeFloatTexture(value: input, textureWidth: 3, textureHeight: 2, arrayLength: 3)
// let inputTexture = device.tensor2texture(value: input, dim: [4, 3, 2, 3]);
// // group 1
// let outputTexture = device.tensor2texture(value: [Float32](), dim: [3, 3, 2, 4])
// let param = TransposeTestParam.init(inputTexture: inputTexture, outputTexture: outputTexture, iC: 3, oC: 4, axis: [3, 1, 2, 0])
//// let param = TransposeTestParam.init(inputTexture: inputTexture, outputTexture: outputTexture, iC: 4, oC: 2, axis: [3, 0, 2, 1])
//// // group 2
//// let outputTexture = device.makeFloatTexture(value: [Float32](), textureWidth: 3, textureHeight: 3, arrayLength: 6)
//// let param = TransposeTestParam.init(inputTexture: inputTexture, outputTexture: outputTexture, iC: 4, oC: 4, axis: [3, 0, 2, 1])
////
// let transposeKernel = TransposeKernel<Float32>.init(device: device, testParam: param)
//
// transposeKernel.test(commandBuffer: buffer, param: param)
//
// buffer.addCompletedHandler { (buffer) in
// let _: Float32? = inputTexture.logDesc(header: "input texture", stridable: false)
// let _: Float32? = outputTexture.logDesc(header: "output texture", stridable: false)
// self.tensorPrint(tensor: input, dim: [4, 3, 2, 3])
// let tx: [Float32] = self.device.texture2tensor(texture: outputTexture, dim: [3, 3, 2, 4])
// self.tensorPrint(tensor: tx, dim: [3, 3, 2, 4])
// }
//
// let input: [Float32] = (0..<24).map { Float32($0) }
// let inputTexture = device.tensor2texture(value: input, dim: [2, 3, 4])
// let outputTexture = device.tensor2texture(value: [Float](), dim: [3, 4, 2])
// let param = TransposeTestParam.init(inputTexture: inputTexture, outputTexture: outputTexture, iC: 4, oC: 2, axis: [0, 2, 3, 1])
// let transposeKernel = TransposeKernel<Float32>.init(device: device, testParam: param)
//
// transposeKernel.test(commandBuffer: buffer, param: param)
//
// buffer.addCompletedHandler { (buffer) in
// let _: Float32? = inputTexture.logDesc(header: "input texture", stridable: false)
// let _: Float32? = outputTexture.logDesc(header: "output texture", stridable: false)
// self.tensorPrint(tensor: input, dim: [2, 3, 4])
// let tx: [Float32] = self.device.texture2tensor(texture: outputTexture, dim: [3, 4, 2])
// self.tensorPrint(tensor: tx, dim: [3, 4, 2])
// }
//
buffer
.
commit
()
}
...
...
metal/paddle-mobile/paddle-mobile/Src/Common/Types.swift
浏览文件 @
005115a1
...
...
@@ -280,12 +280,12 @@ public class FetchHolder: Variant {
extension
FetchHolder
:
CustomStringConvertible
,
CustomDebugStringConvertible
{
public
var
description
:
String
{
fatalError
()
// return "\(result)"
// return "\(result)"
}
public
var
debugDescription
:
String
{
fatalError
()
// return "\(result)"
// return "\(result)"
}
...
...
metal/paddle-mobile/paddle-mobile/Src/Framework/Dim.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Framework/Executor.swift
浏览文件 @
005115a1
...
...
@@ -14,7 +14,6 @@
import
Foundation
let
testTo
=
5
var
isTest
=
false
...
...
@@ -113,18 +112,24 @@ public class Executor<P: PrecisionType> {
//将输入写进文件
/*
let inputArr = resInput.toTensor(dim: (n: dim[0], c: dim[3], h: dim[1], w: dim[2]))
print(dim)
writeToLibrary(fileName: "test_image_super
", array: inputArr)
writeToLibrary(fileName: "yolo_input
", array: inputArr)
print(" write done ")
return
*/
/* 输出 op 计算结果
for op in SSelf.ops {
//输出 op 计算结果
if
GlobalConfig
.
shared
.
debug
{
for
i
in
0
..<
SSelf
.
ops
.
count
{
print
(
"第
\(
i
)
个 op: "
)
let
op
=
SSelf
.
ops
[
i
]
op
.
delogOutput
()
}
*/
}
var
resultHolder
:
GPUResultHolder
if
except
>
0
{
...
...
metal/paddle-mobile/paddle-mobile/Src/Framework/Loader.swift
浏览文件 @
005115a1
...
...
@@ -155,7 +155,7 @@ public class Loader<P: PrecisionType> {
let
originProgramDesc
=
PMProgramDesc
.
init
(
protoProgram
:
protoProgram
)
let
programDesc
=
ProgramOptimize
<
P
>.
init
()
.
optimize
(
originProgramDesc
:
originProgramDesc
)
// let programDesc = PMProgramDesc.init(protoProgram: protoProgram)
// let programDesc = PMProgramDesc.init(protoProgram: protoProgram)
print
(
programDesc
)
...
...
@@ -221,7 +221,7 @@ public class Loader<P: PrecisionType> {
}
}
else
{
if
varDesc
.
name
==
fetchKey
{
// scope[varDesc.name] = ResultHolder.init(inDim: [], inResult: [], inCapacity: <#Int#>, inElapsedTime: 0.0)
// scope[varDesc.name] = ResultHolder.init(inDim: [], inResult: [], inCapacity: <#Int#>, inElapsedTime: 0.0)
}
else
if
varDesc
.
name
==
feedKey
{
}
}
...
...
metal/paddle-mobile/paddle-mobile/Src/Framework/Tensor.swift
浏览文件 @
005115a1
...
...
@@ -97,7 +97,7 @@ class Tensor<P: PrecisionType>: Tensorial {
func
initBuffer
(
device
:
MTLDevice
,
precision
:
ComputePrecision
=
.
Float16
,
padWhenOneC
:
Bool
=
false
,
convertToNHWC
:
Bool
=
true
,
withTranspose
:
Bool
=
false
)
{
if
convertToNHWC
{
// print(layout)
// print(layout)
convert
(
to
:
DataLayout
.
NHWC
())
}
...
...
metal/paddle-mobile/paddle-mobile/Src/Framework/Texture.swift
浏览文件 @
005115a1
...
...
@@ -46,17 +46,17 @@ extension InputTexture {
.height = b
.len = a * d + 3 / 4
低于 4 维的 tensor,transpose 必须为 [0, 1, 2, 3] 既不考虑 transpose
低于 4 维的 tensor,transpose 必须为 [0, 1, 2, 3] 既不考虑 transpose
// TODO transpose 对于低维 tensor 的扩展原则。。。
// [a, b] -> [1, 1, a, b] transpose 必须为 [0, 1, x, x]
// [a] -> [1, 1, 1, a] transpose 必须为 [0, 1, 2, 3]
// [a, b, c] -> [1, a, b, c] tranpose 必须为 [0, x, x, x]
// TODO transpose 对于低维 tensor 的扩展原则。。。
// [a, b] -> [1, 1, a, b] transpose 必须为 [0, 1, x, x]
// [a] -> [1, 1, 1, a] transpose 必须为 [0, 1, 2, 3]
// [a, b, c] -> [1, a, b, c] tranpose 必须为 [0, x, x, x]
3 维 tensor [a, b, c] 对应的 texture_2darray,
.width = c
.height = b
.len = a + 3 / 4
3 维 tensor [a, b, c] 对应的 texture_2darray,
.width = c
.height = b
.len = a + 3 / 4
2 维 tensor [a, b] 对应的 texture_2darray
.width = b + 3 / 4
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/OpCreator.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/OpParam.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Base/Operator.swift
浏览文件 @
005115a1
...
...
@@ -45,7 +45,7 @@ extension Runable where Self: OperatorProtocol{
}
func
inputVariant
()
->
[
String
:
[
MTLBuffer
]]
{
// return [:]
// return [:]
fatalError
(
" op
\(
type
)
need implement inputVariant"
)
}
...
...
@@ -202,4 +202,4 @@ let opInfos = [gConvType : (inputs: ["Input"], outputs: ["Out
gConvAddAddPreluType
:
(
inputs
:
[
"Input"
],
outputs
:
[
"Out"
]),
gElementwiseAddPreluType
:
(
inputs
:
[
"X"
],
outputs
:
[
"Out"
]),
gFusionConvAddType
:
(
inputs
:
[
"Input"
],
outputs
:
[
"Out"
])
]
]
metal/paddle-mobile/paddle-mobile/Src/Operators/BatchNormOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/BilinearInterpOp.swift
浏览文件 @
005115a1
...
...
@@ -56,7 +56,7 @@ class BilinearInterpOp<P: PrecisionType>: Operator<BilinearInterpKernel<P>, Bili
print
(
"
\(
type
)
output: "
)
let
device
=
para
.
output
.
metalTexture
!.
device
let
outputArray
:
[
Float32
]
=
device
.
texture2tensor
(
texture
:
para
.
output
.
metalTexture
,
dim
:
para
.
output
.
tensorDim
.
dims
,
transpose
:
para
.
output
.
transpose
)
// print(outputArray)
// print(outputArray)
print
(
outputArray
.
strideArray
())
}
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/BoxcoderOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConcatOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddAddPreluOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddBatchNormReluOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddOp.swift
浏览文件 @
005115a1
...
...
@@ -93,22 +93,22 @@ class ConvAddOp<P: PrecisionType>: Operator<ConvAddKernel<P>, ConvAddParam<P>>,
}
func
delogOutput
()
{
// print("op \(type): ")
// print(" padding: ")
// print(para.paddings)
// print("stride: ")
// print(para.stride)
// print("dilations: ")
// print(para.dilations)
// print(" para input dim: ")
// print(para.input.dim)
// print(" para filter dim: ")
// print(para.filter.dim)
// print(" para output dim: ")
// print(para.output.dim)
// print(" biase: ")
// let biase: [Float32] = para.y.buffer.array()
// print(biase)
// print("op \(type): ")
// print(" padding: ")
// print(para.paddings)
// print("stride: ")
// print(para.stride)
// print("dilations: ")
// print(para.dilations)
// print(" para input dim: ")
// print(para.input.dim)
// print(" para filter dim: ")
// print(para.filter.dim)
// print(" para output dim: ")
// print(para.output.dim)
// print(" biase: ")
// let biase: [Float32] = para.y.buffer.array()
// print(biase)
print
(
"
\(
type
)
output: "
)
print
(
para
.
output
.
metalTexture
)
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvAddPreluOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvBNReluOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/ConvTransposeOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/DepthwiseConvOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/DwConvBNReluOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/ElementwiseAddOp.swift
浏览文件 @
005115a1
...
...
@@ -35,16 +35,16 @@ class ElementwiseAddParam<P: PrecisionType>: OpParam {
inputY
.
metalTexture
=
device
.
tensor2texture
(
value
:
value
,
dim
:
tensorY
.
dim
.
dims
,
transpose
:
[
0
,
1
,
2
,
3
],
inComputePrecision
:
GlobalConfig
.
shared
.
computePrecision
)
}
// required init(device: MTLDevice, param: ElementwiseAddParam<P>) {
// param.output.initTexture(device: device, inTranspose: param.inputX.transpose, computePrecision: computePrecision)
// if computePrecision == .Float32 {
// super.init(device: device, inFunctionName: "elementwise_add")
// } else if computePrecision == .Float16 {
// super.init(device: device, inFunctionName: "elementwise_add_half")
// } else {
// fatalError()
// }
// }
// required init(device: MTLDevice, param: ElementwiseAddParam<P>) {
// param.output.initTexture(device: device, inTranspose: param.inputX.transpose, computePrecision: computePrecision)
// if computePrecision == .Float32 {
// super.init(device: device, inFunctionName: "elementwise_add")
// } else if computePrecision == .Float16 {
// super.init(device: device, inFunctionName: "elementwise_add_half")
// } else {
// fatalError()
// }
// }
var
offset
=
axis
if
axis
==
-
1
{
...
...
@@ -65,7 +65,7 @@ class ElementwiseAddOp<P: PrecisionType>: Operator<ElementwiseAddKernel<P>, Elem
typealias
OpType
=
ElementwiseAddOp
<
P
>
func
inferShape
()
{
// para.output.dim = para.input.dim
// para.output.dim = para.input.dim
}
func
runImpl
(
device
:
MTLDevice
,
buffer
:
MTLCommandBuffer
)
throws
{
...
...
metal/paddle-mobile/paddle-mobile/Src/Operators/ElementwiseAddPreluOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/FeedOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/FetchOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/FlattenOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/Base/Kernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/BatchNormKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/BilinearInterpKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/BoxcoderKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConcatKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvAddAddPreluKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvAddBatchNormReluKernel.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvAddKernel.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvAddPreluKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvBNReluKernel.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvKernel.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ConvTransposeKernel.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ElementwiseAddKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ElementwiseAddPreluKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/FetchKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/FlattenKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/MulticlassNMSKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/PoolKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/PreluKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/PriorBoxKernel.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ReluKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ReshapeKernel.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ResizeBilinearKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/Scale.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/ShapeKernel.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/SoftmaxKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/SplitKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/Texture2DTo2DArrayKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/Kernels/TransposeKernel.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/MulticlassNMSOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/PoolOp.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/PreluOp.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/PriorBoxOp.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/ReluOp.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/ReshapeOp.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/ResizeBilinearOp.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
metal/paddle-mobile/paddle-mobile/Src/Operators/ShapeOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/SoftmaxOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/SplitOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Operators/TransposeOp.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Program/PMBlockDesc.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Program/PMOpDesc.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Program/PMVarDesc.swift
浏览文件 @
005115a1
metal/paddle-mobile/paddle-mobile/Src/Program/ProgramOptimize.swift
浏览文件 @
005115a1
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录