Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
32efc50c
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看板
提交
32efc50c
编写于
9月 19, 2018
作者:
X
xiaohaichun
提交者:
GitHub
9月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #994 from xiaohaichun/metal
Metal
上级
e17a9d1f
7dc9fd05
变更
21
展开全部
显示空白变更内容
内联
并排
Showing
21 changed file
with
1723 addition
and
148 deletion
+1723
-148
.gitignore
.gitignore
+219
-0
metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj
...-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj
+956
-104
metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/xcuserdata/xiaohaichun.xcuserdatad/xcschemes/xcschememanagement.plist
...iaohaichun.xcuserdatad/xcschemes/xcschememanagement.plist
+14
-0
metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard
...mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard
+75
-8
metal/paddle-mobile-demo/paddle-mobile-demo/LoadPointerViewController.h
...obile-demo/paddle-mobile-demo/LoadPointerViewController.h
+13
-0
metal/paddle-mobile-demo/paddle-mobile-demo/LoadPointerViewController.m
...obile-demo/paddle-mobile-demo/LoadPointerViewController.m
+154
-0
metal/paddle-mobile-demo/paddle-mobile-demo/paddle-mobile-demo-Bridging-Header.h
...o/paddle-mobile-demo/paddle-mobile-demo-Bridging-Header.h
+1
-3
metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/xcuserdata/xiaohaichun.xcuserdatad/xcschemes/xcschememanagement.plist
...iaohaichun.xcuserdatad/xcschemes/xcschememanagement.plist
+14
-0
metal/paddle-mobile-unit-test/paddle-mobile-unit-test/AppDelegate.swift
...obile-unit-test/paddle-mobile-unit-test/AppDelegate.swift
+3
-3
metal/paddle-mobile-unit-test/paddle-mobile-unit-test/ViewController.swift
...le-unit-test/paddle-mobile-unit-test/ViewController.swift
+3
-3
metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/xiaohaichun.xcuserdatad/xcschemes/paddle-mobile.xcscheme
.../xiaohaichun.xcuserdatad/xcschemes/paddle-mobile.xcscheme
+80
-0
metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/xiaohaichun.xcuserdatad/xcschemes/xcschememanagement.plist
...iaohaichun.xcuserdatad/xcschemes/xcschememanagement.plist
+14
-0
metal/paddle-mobile/paddle-mobile/Genet.swift
metal/paddle-mobile/paddle-mobile/Genet.swift
+12
-0
metal/paddle-mobile/paddle-mobile/MobileNetSSD.swift
metal/paddle-mobile/paddle-mobile/MobileNetSSD.swift
+12
-0
metal/paddle-mobile/paddle-mobile/Net.swift
metal/paddle-mobile/paddle-mobile/Net.swift
+11
-3
metal/paddle-mobile/paddle-mobile/PaddleMobile.swift
metal/paddle-mobile/paddle-mobile/PaddleMobile.swift
+4
-1
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.h
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.h
+2
-1
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m
+44
-10
metal/paddle-mobile/paddle-mobile/Program/Program.swift
metal/paddle-mobile/paddle-mobile/Program/Program.swift
+5
-0
metal/paddle-mobile/paddle-mobile/framework/Loader.swift
metal/paddle-mobile/paddle-mobile/framework/Loader.swift
+86
-12
metal/paddle-mobile/paddle-mobile/paddle_mobile.h
metal/paddle-mobile/paddle-mobile/paddle_mobile.h
+1
-0
未找到文件。
.gitignore
浏览文件 @
32efc50c
...
@@ -87,3 +87,222 @@ metal/models/
...
@@ -87,3 +87,222 @@ metal/models/
metal/images/
metal/images/
*.a
*.a
metal/paddle-mobile/paddle-mobile/CPU/libpaddle-mobile.a
metal/paddle-mobile/paddle-mobile/CPU/libpaddle-mobile.a
metal/paddle-mobile-demo/paddle-mobile-demo/images/banana.jpeg
metal/paddle-mobile-demo/paddle-mobile-demo/images/hand.jpg
metal/paddle-mobile-demo/paddle-mobile-demo/images/iphone.JPG
metal/paddle-mobile-demo/paddle-mobile-demo/images/paddle-mobile.png
metal/paddle-mobile-demo/paddle-mobile-demo/images/synset.txt
metal/paddle-mobile-demo/paddle-mobile-demo/models/genet/genet_model
metal/paddle-mobile-demo/paddle-mobile-demo/models/genet/genet_params
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenet/model
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenet/params
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenet_combine/model
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenet_combine/params
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenet_ssd_hand/ssd_hand_model
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenet_ssd_hand/ssd_hand_params
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/__model__
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_0.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_0.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_0.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_0.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_1.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_1.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_1.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_1.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_10.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_10.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_10.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_10.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_11.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_11.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_11.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_11.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_12.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_12.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_12.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_12.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_13.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_13.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_13.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_13.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_14.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_14.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_14.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_14.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_15.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_15.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_15.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_15.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_16.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_16.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_16.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_16.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_17.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_17.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_17.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_17.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_18.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_18.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_18.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_18.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_19.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_19.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_19.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_19.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_2.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_2.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_2.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_2.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_20.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_20.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_20.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_20.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_21.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_21.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_21.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_21.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_22.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_22.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_22.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_22.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_23.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_23.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_23.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_23.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_24.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_24.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_24.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_24.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_25.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_25.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_25.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_25.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_26.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_26.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_26.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_26.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_27.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_27.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_27.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_27.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_28.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_28.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_28.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_28.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_29.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_29.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_29.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_29.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_3.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_3.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_3.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_3.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_30.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_30.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_30.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_30.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_31.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_31.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_31.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_31.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_32.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_32.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_32.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_32.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_33.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_33.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_33.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_33.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_34.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_34.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_34.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_34.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_4.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_4.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_4.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_4.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_5.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_5.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_5.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_5.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_6.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_6.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_6.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_6.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_7.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_7.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_7.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_7.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_8.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_8.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_8.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_8.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_9.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_9.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_9.w_1
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/batch_norm_9.w_2
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_0.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_1.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_10.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_11.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_12.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_13.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_14.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_15.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_16.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_17.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_18.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_19.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_2.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_20.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_21.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_22.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_22.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_23.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_23.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_24.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_24.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_25.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_25.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_26.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_26.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_27.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_27.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_28.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_28.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_29.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_29.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_3.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_30.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_30.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_31.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_31.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_32.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_32.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_33.b_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_33.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_4.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_5.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_6.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_7.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_8.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/conv2d_9.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_0.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_1.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_10.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_11.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_12.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_2.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_3.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_4.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_5.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_6.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_7.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_8.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/mobilenetssd/depthwise_conv2d_9.w_0
metal/paddle-mobile-demo/paddle-mobile-demo/models/yolo/mobilenet
metal/paddle-mobile-demo/paddle-mobile-demo/models/yolo/model
metal/paddle-mobile-demo/paddle-mobile-demo/models/yolo/params
metal/paddle-mobile-demo/paddle-mobile-demo/models/yolo/yolo
metal/paddle-mobile-demo/paddle-mobile-demo/models/fluid_fssd_new_ar/ar_model
metal/paddle-mobile-demo/paddle-mobile-demo/models/fluid_fssd_new_ar/ar_params
metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj
浏览文件 @
32efc50c
此差异已折叠。
点击以展开。
metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/xcuserdata/xiaohaichun.xcuserdatad/xcschemes/xcschememanagement.plist
0 → 100644
浏览文件 @
32efc50c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
SchemeUserState
</key>
<dict>
<key>
paddle-mobile-demo.xcscheme
</key>
<dict>
<key>
orderHint
</key>
<integer>
6
</integer>
</dict>
</dict>
</dict>
</plist>
metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard
浏览文件 @
32efc50c
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"14113"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
initialViewController=
"
BYZ-38-t0r
"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"14113"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
initialViewController=
"
4MS-jc-i6A
"
>
<device
id=
"retina4_7"
orientation=
"portrait"
>
<device
id=
"retina4_7"
orientation=
"portrait"
>
<adaptation
id=
"fullscreen"
/>
<adaptation
id=
"fullscreen"
/>
</device>
</device>
...
@@ -50,10 +50,9 @@
...
@@ -50,10 +50,9 @@
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ZZh-fw-LwK"
>
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ZZh-fw-LwK"
>
<rect
key=
"frame"
x=
"0.0"
y=
"20"
width=
"225"
height=
"247"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"20"
width=
"225"
height=
"247"
/>
</imageView>
</imageView>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Platform:"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"2EB-m2-a3L"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
horizontalCompressionResistancePriority=
"749"
text=
"Platform:"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"2EB-m2-a3L"
>
<rect
key=
"frame"
x=
"10"
y=
"538"
width=
"
68
"
height=
"24"
/>
<rect
key=
"frame"
x=
"10"
y=
"538"
width=
"
35
"
height=
"24"
/>
<constraints>
<constraints>
<constraint
firstAttribute=
"width"
constant=
"68"
id=
"Q5J-tq-JSX"
/>
<constraint
firstAttribute=
"height"
constant=
"24"
id=
"SYv-As-Si8"
/>
<constraint
firstAttribute=
"height"
constant=
"24"
id=
"SYv-As-Si8"
/>
</constraints>
</constraints>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"20"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"20"
/>
...
@@ -61,12 +60,12 @@
...
@@ -61,12 +60,12 @@
<nil
key=
"highlightedColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
</label>
<pickerView
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"DlO-dk-RMr"
>
<pickerView
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"DlO-dk-RMr"
>
<rect
key=
"frame"
x=
"
88"
y=
"510.5"
width=
"287
"
height=
"80"
/>
<rect
key=
"frame"
x=
"
55"
y=
"510.5"
width=
"320
"
height=
"80"
/>
<constraints>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"80"
id=
"Sbi-05-Mwd"
/>
<constraint
firstAttribute=
"height"
constant=
"80"
id=
"Sbi-05-Mwd"
/>
</constraints>
</constraints>
</pickerView>
</pickerView>
<pickerView
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"6MG-gv-hD5"
>
<pickerView
contentMode=
"scaleToFill"
horizontalCompressionResistancePriority=
"749"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"6MG-gv-hD5"
>
<rect
key=
"frame"
x=
"85"
y=
"401"
width=
"290"
height=
"80"
/>
<rect
key=
"frame"
x=
"85"
y=
"401"
width=
"290"
height=
"80"
/>
<constraints>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"80"
id=
"yAL-JY-G6b"
/>
<constraint
firstAttribute=
"height"
constant=
"80"
id=
"yAL-JY-G6b"
/>
...
@@ -75,7 +74,6 @@
...
@@ -75,7 +74,6 @@
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Models"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"avL-VK-Kha"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Models"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"avL-VK-Kha"
>
<rect
key=
"frame"
x=
"10"
y=
"429"
width=
"65"
height=
"24"
/>
<rect
key=
"frame"
x=
"10"
y=
"429"
width=
"65"
height=
"24"
/>
<constraints>
<constraints>
<constraint
firstAttribute=
"width"
constant=
"65"
id=
"6oA-g2-Xq4"
/>
<constraint
firstAttribute=
"height"
constant=
"24"
id=
"EwE-B3-z2R"
/>
<constraint
firstAttribute=
"height"
constant=
"24"
id=
"EwE-B3-z2R"
/>
</constraints>
</constraints>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"20"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"20"
/>
...
@@ -236,7 +234,76 @@
...
@@ -236,7 +234,76 @@
</viewController>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"dkx-z0-nzr"
sceneMemberID=
"firstResponder"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"dkx-z0-nzr"
sceneMemberID=
"firstResponder"
/>
</objects>
</objects>
<point
key=
"canvasLocation"
x=
"-1127"
y=
"-3"
/>
<point
key=
"canvasLocation"
x=
"-1449"
y=
"-3"
/>
</scene>
<!--Load Pointer View Controller-->
<scene
sceneID=
"56v-9i-I4d"
>
<objects>
<viewController
id=
"4MS-jc-i6A"
customClass=
"LoadPointerViewController"
sceneMemberID=
"viewController"
>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"VbZ-nk-rJR"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"375"
height=
"667"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<subviews>
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"2p5-S3-M4T"
>
<rect
key=
"frame"
x=
"16"
y=
"63"
width=
"240"
height=
"128"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
</imageView>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"37q-nm-0H7"
>
<rect
key=
"frame"
x=
"38"
y=
"610"
width=
"42"
height=
"30"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"30"
id=
"ofW-G3-KST"
/>
<constraint
firstAttribute=
"width"
constant=
"42"
id=
"pwd-tO-zcJ"
/>
</constraints>
<state
key=
"normal"
title=
"Image"
/>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"fAg-ai-yaA"
>
<rect
key=
"frame"
x=
"119"
y=
"610"
width=
"34"
height=
"30"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"30"
id=
"IES-jf-Z1n"
/>
<constraint
firstAttribute=
"width"
constant=
"34"
id=
"jxK-Xn-WCE"
/>
</constraints>
<state
key=
"normal"
title=
"Load"
/>
<connections>
<action
selector=
"loaderButtonPressed:"
destination=
"4MS-jc-i6A"
eventType=
"touchUpInside"
id=
"3cy-PD-aiE"
/>
</connections>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"pdS-6e-Pd1"
>
<rect
key=
"frame"
x=
"185"
y=
"610"
width=
"49"
height=
"30"
/>
<constraints>
<constraint
firstAttribute=
"width"
constant=
"49"
id=
"ddY-uM-fzA"
/>
<constraint
firstAttribute=
"height"
constant=
"30"
id=
"yKd-YL-UML"
/>
</constraints>
<state
key=
"normal"
title=
"Predict"
/>
<connections>
<action
selector=
"predictButtonPressed:"
destination=
"4MS-jc-i6A"
eventType=
"touchUpInside"
id=
"sOH-iT-s1w"
/>
</connections>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"DZa-sd-lY7"
>
<rect
key=
"frame"
x=
"279"
y=
"610"
width=
"34"
height=
"30"
/>
<constraints>
<constraint
firstAttribute=
"width"
constant=
"34"
id=
"aSO-4q-PgA"
/>
<constraint
firstAttribute=
"height"
constant=
"30"
id=
"eAt-Uc-BxX"
/>
</constraints>
<state
key=
"normal"
title=
"clear"
/>
</button>
</subviews>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstItem=
"vsb-FH-h7h"
firstAttribute=
"bottom"
secondItem=
"37q-nm-0H7"
secondAttribute=
"bottom"
constant=
"27"
id=
"4Wf-Uh-gvr"
/>
<constraint
firstItem=
"DZa-sd-lY7"
firstAttribute=
"leading"
secondItem=
"pdS-6e-Pd1"
secondAttribute=
"trailing"
constant=
"45"
id=
"8dB-uI-cs9"
/>
<constraint
firstItem=
"fAg-ai-yaA"
firstAttribute=
"leading"
secondItem=
"37q-nm-0H7"
secondAttribute=
"trailing"
constant=
"39"
id=
"EAV-Oq-jeD"
/>
<constraint
firstItem=
"vsb-FH-h7h"
firstAttribute=
"bottom"
secondItem=
"fAg-ai-yaA"
secondAttribute=
"bottom"
constant=
"27"
id=
"Px0-A9-Eql"
/>
<constraint
firstItem=
"pdS-6e-Pd1"
firstAttribute=
"leading"
secondItem=
"fAg-ai-yaA"
secondAttribute=
"trailing"
constant=
"32"
id=
"ZUR-Nv-aNb"
/>
<constraint
firstItem=
"vsb-FH-h7h"
firstAttribute=
"bottom"
secondItem=
"pdS-6e-Pd1"
secondAttribute=
"bottom"
constant=
"27"
id=
"kPx-mt-ab9"
/>
<constraint
firstItem=
"37q-nm-0H7"
firstAttribute=
"leading"
secondItem=
"vsb-FH-h7h"
secondAttribute=
"leading"
constant=
"38"
id=
"trH-Fq-sSv"
/>
<constraint
firstItem=
"vsb-FH-h7h"
firstAttribute=
"bottom"
secondItem=
"DZa-sd-lY7"
secondAttribute=
"bottom"
constant=
"27"
id=
"yNJ-hq-2Qg"
/>
</constraints>
<viewLayoutGuide
key=
"safeArea"
id=
"vsb-FH-h7h"
/>
</view>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"hGb-Pb-icS"
userLabel=
"First Responder"
sceneMemberID=
"firstResponder"
/>
</objects>
<point
key=
"canvasLocation"
x=
"-514"
y=
"-3"
/>
</scene>
</scene>
</scenes>
</scenes>
<resources>
<resources>
...
...
metal/paddle-mobile-demo/paddle-mobile-demo/LoadPointerViewController.h
0 → 100644
浏览文件 @
32efc50c
//
// LoadPointerViewController.h
// paddle-mobile-demo
//
// Created by Xiao,Haichun on 2018/9/19.
// Copyright © 2018年 orange. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface
LoadPointerViewController
:
UIViewController
@end
metal/paddle-mobile-demo/paddle-mobile-demo/LoadPointerViewController.m
0 → 100644
浏览文件 @
32efc50c
//
// LoadPointerViewController.m
// paddle-mobile-demo
//
// Created by Xiao,Haichun on 2018/9/19.
// Copyright © 2018年 orange. All rights reserved.
//
#import "LoadPointerViewController.h"
#import <Metal/Metal.h>
#import "paddle-mobile-demo-Bridging-Header.h"
@interface
LoadPointerViewController
()
@property
(
strong
,
nonatomic
)
id
<
MTLDevice
>
device
;
@property
(
strong
,
nonatomic
)
id
<
MTLTexture
>
texture
;
@property
(
strong
,
nonatomic
)
id
<
MTLCommandQueue
>
queue
;
@property
(
strong
,
nonatomic
)
PaddleMobileGPU
*
runner
;
@property
(
strong
,
nonatomic
)
ModelConfig
*
modelConfig
;
@end
@implementation
LoadPointerViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
device
=
MTLCreateSystemDefaultDevice
();
self
.
queue
=
[
self
.
device
newCommandQueue
];
// Do any additional setup after loading the view.
NSString
*
modelPath
=
[[
NSBundle
mainBundle
]
URLForResource
:
@"genet_model"
withExtension
:
nil
].
path
;
NSString
*
paramPath
=
[[
NSBundle
mainBundle
]
URLForResource
:
@"genet_params"
withExtension
:
nil
].
path
;
long
fileSize
;
FILE
*
fp
;
fp
=
fopen
([
modelPath
UTF8String
],
"rb"
);
fseek
(
fp
,
0
,
SEEK_END
);
fileSize
=
ftell
(
fp
);
rewind
(
fp
);
void
*
buffer
=
malloc
(
fileSize
);
fread
(
buffer
,
1
,
fileSize
,
fp
);
fclose
(
fp
);
long
paramfileSize
;
FILE
*
parmaFilePointer
;
parmaFilePointer
=
fopen
([
paramPath
UTF8String
],
"rb"
);
fseek
(
parmaFilePointer
,
0
,
SEEK_END
);
paramfileSize
=
ftell
(
parmaFilePointer
);
rewind
(
parmaFilePointer
);
void
*
parmaBuffer
=
malloc
(
paramfileSize
);
fread
(
parmaBuffer
,
1
,
paramfileSize
,
parmaFilePointer
);
fclose
(
parmaFilePointer
);
_modelConfig
=
[[
ModelConfig
alloc
]
init
];
_modelConfig
.
means
=
@[[
NSNumber
numberWithFloat
:
128
.
0
],
[
NSNumber
numberWithFloat
:
128
.
0
],
[
NSNumber
numberWithFloat
:
128
.
0
]];
_modelConfig
.
scale
=
0
.
017
;
_modelConfig
.
dims
=
@[[
NSNumber
numberWithFloat
:
1
],
[
NSNumber
numberWithFloat
:
128
.],
[
NSNumber
numberWithFloat
:
128
.
0
],[
NSNumber
numberWithFloat
:
3
.
0
]];
_modelConfig
.
modelPointer
=
buffer
;
_modelConfig
.
modelSize
=
(
int
)
fileSize
;
_modelConfig
.
paramPointer
=
parmaBuffer
;
_modelConfig
.
paramSize
=
(
int
)
paramfileSize
;
}
-
(
IBAction
)
loaderButtonPressed
:(
id
)
sender
{
_runner
=
[[
PaddleMobileGPU
alloc
]
initWithCommandQueue
:
self
.
queue
net
:
GenetType
modelConfig
:
_modelConfig
];
[
_runner
load
];
}
-
(
IBAction
)
predictButtonPressed
:(
id
)
sender
{
[
self
predict
];
}
-
(
id
<
MTLTexture
>
)
createTextureFromImage
:(
UIImage
*
)
image
device
:
(
id
<
MTLDevice
>
)
device
{
image
=
[
UIImage
imageWithCGImage
:[
image
CGImage
]
scale:
[
image
scale
]
orientation:
UIImageOrientationLeft
];
NSLog
(
@"orientation and size and stuff %ld %f %f"
,
(
long
)
image
.
imageOrientation
,
image
.
size
.
width
,
image
.
size
.
height
);
CGImageRef
imageRef
=
image
.
CGImage
;
size_t
width
=
self
.
view
.
frame
.
size
.
width
;
size_t
height
=
self
.
view
.
frame
.
size
.
height
;
size_t
bitsPerComponent
=
CGImageGetBitsPerComponent
(
imageRef
);
size_t
bitsPerPixel
=
CGImageGetBitsPerPixel
(
imageRef
);
CGColorSpaceRef
colorSpace
=
CGImageGetColorSpace
(
imageRef
);
CGImageAlphaInfo
alphaInfo
=
CGImageGetAlphaInfo
(
imageRef
);
// NSLog(@"%@ %u", colorSpace, alphaInfo);
CGBitmapInfo
bitmapInfo
=
kCGBitmapByteOrderDefault
|
alphaInfo
;
// NSLog(@"bitmap info %u", bitmapInfo);
CGContextRef
context
=
CGBitmapContextCreate
(
NULL
,
width
,
height
,
bitsPerComponent
,
(
bitsPerPixel
/
8
)
*
width
,
colorSpace
,
bitmapInfo
);
if
(
!
context
)
{
NSLog
(
@"Failed to load image, probably an unsupported texture type"
);
return
nil
;
}
CGContextDrawImage
(
context
,
CGRectMake
(
0
,
0
,
width
,
height
),
image
.
CGImage
);
MTLPixelFormat
format
=
MTLPixelFormatRGBA8Unorm
;
MTLTextureDescriptor
*
texDesc
=
[
MTLTextureDescriptor
texture2DDescriptorWithPixelFormat
:
format
width:
width
height:
height
mipmapped:
NO
];
id
<
MTLTexture
>
texture
=
[
device
newTextureWithDescriptor
:
texDesc
];
[
texture
replaceRegion
:
MTLRegionMake2D
(
0
,
0
,
width
,
height
)
mipmapLevel:
0
withBytes:
CGBitmapContextGetData
(
context
)
bytesPerRow:
4
*
width
];
return
texture
;
}
-
(
void
)
predict
{
_texture
=
[
self
createTextureFromImage
:[
UIImage
imageNamed
:
@"hand.jpg"
]
device
:
self
.
device
];
[
_runner
predict
:
_texture
withCompletion
:
^
(
BOOL
success
,
NSArray
<
NSNumber
*>
*
result
)
{
if
(
success
)
{
for
(
int
i
=
0
;
i
<
result
.
count
;
i
++
)
{
NSNumber
*
number
=
result
[
i
];
NSLog
(
@"result %d = %f:"
,
i
,
[
number
floatValue
]);
}
}
}];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
metal/paddle-mobile-demo/paddle-mobile-demo/paddle-mobile-demo-Bridging-Header.h
浏览文件 @
32efc50c
...
@@ -2,6 +2,4 @@
...
@@ -2,6 +2,4 @@
// Use this file to import your target's public headers that you would like to expose to Swift.
// Use this file to import your target's public headers that you would like to expose to Swift.
//
//
#import <paddle_mobile/paddle_mobile.h>
//#import <paddle_mobile/>
metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/xcuserdata/xiaohaichun.xcuserdatad/xcschemes/xcschememanagement.plist
0 → 100644
浏览文件 @
32efc50c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
SchemeUserState
</key>
<dict>
<key>
paddle-mobile-unit-test.xcscheme
</key>
<dict>
<key>
orderHint
</key>
<integer>
5
</integer>
</dict>
</dict>
</dict>
</plist>
metal/paddle-mobile-unit-test/paddle-mobile-unit-test/AppDelegate.swift
浏览文件 @
32efc50c
metal/paddle-mobile-unit-test/paddle-mobile-unit-test/ViewController.swift
浏览文件 @
32efc50c
metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/xiaohaichun.xcuserdatad/xcschemes/paddle-mobile.xcscheme
0 → 100644
浏览文件 @
32efc50c
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"0940"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"YES"
buildImplicitDependencies =
"YES"
>
<BuildActionEntries>
<BuildActionEntry
buildForTesting =
"YES"
buildForRunning =
"YES"
buildForProfiling =
"YES"
buildForArchiving =
"YES"
buildForAnalyzing =
"YES"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"FC039B6920E11C3C0081E9F8"
BuildableName =
"paddle_mobile.framework"
BlueprintName =
"paddle-mobile"
ReferencedContainer =
"container:paddle-mobile.xcodeproj"
>
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration =
"Debug"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv =
"YES"
>
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration =
"Release"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle =
"0"
useCustomWorkingDirectory =
"NO"
ignoresPersistentStateOnLaunch =
"NO"
debugDocumentVersioning =
"YES"
debugServiceExtension =
"internal"
allowLocationSimulation =
"YES"
>
<MacroExpansion>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"FC039B6920E11C3C0081E9F8"
BuildableName =
"paddle_mobile.framework"
BlueprintName =
"paddle-mobile"
ReferencedContainer =
"container:paddle-mobile.xcodeproj"
>
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration =
"Release"
shouldUseLaunchSchemeArgsEnv =
"YES"
savedToolIdentifier =
""
useCustomWorkingDirectory =
"NO"
debugDocumentVersioning =
"YES"
>
<MacroExpansion>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"FC039B6920E11C3C0081E9F8"
BuildableName =
"paddle_mobile.framework"
BlueprintName =
"paddle-mobile"
ReferencedContainer =
"container:paddle-mobile.xcodeproj"
>
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration =
"Debug"
>
</AnalyzeAction>
<ArchiveAction
buildConfiguration =
"Release"
revealArchiveInOrganizer =
"YES"
>
</ArchiveAction>
</Scheme>
metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/xiaohaichun.xcuserdatad/xcschemes/xcschememanagement.plist
0 → 100644
浏览文件 @
32efc50c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
SchemeUserState
</key>
<dict>
<key>
paddle-mobile.xcscheme
</key>
<dict>
<key>
orderHint
</key>
<integer>
4
</integer>
</dict>
</dict>
</dict>
</plist>
metal/paddle-mobile/paddle-mobile/Genet.swift
浏览文件 @
32efc50c
...
@@ -27,6 +27,18 @@ public class Genet: Net {
...
@@ -27,6 +27,18 @@ public class Genet: Net {
dim
=
(
n
:
1
,
h
:
128
,
w
:
128
,
c
:
3
)
dim
=
(
n
:
1
,
h
:
128
,
w
:
128
,
c
:
3
)
}
}
@objc
override
public
init
(
device
:
MTLDevice
,
paramPointer
:
UnsafeMutableRawPointer
,
paramSize
:
Int
,
modePointer
:
UnsafeMutableRawPointer
,
modelSize
:
Int
)
{
super
.
init
(
device
:
device
,
paramPointer
:
paramPointer
,
paramSize
:
paramSize
,
modePointer
:
modePointer
,
modelSize
:
modelSize
)
means
=
[
128.0
,
128.0
,
128.0
]
scale
=
0.017
except
=
0
modelPath
=
""
paramPath
=
""
modelDir
=
""
preprocessKernel
=
GenetPreProccess
.
init
(
device
:
device
)
dim
=
(
n
:
1
,
h
:
128
,
w
:
128
,
c
:
3
)
}
class
GenetPreProccess
:
CusomKernel
{
class
GenetPreProccess
:
CusomKernel
{
init
(
device
:
MTLDevice
)
{
init
(
device
:
MTLDevice
)
{
let
s
=
CusomKernel
.
Shape
.
init
(
inWidth
:
128
,
inHeight
:
128
,
inChannel
:
3
)
let
s
=
CusomKernel
.
Shape
.
init
(
inWidth
:
128
,
inHeight
:
128
,
inChannel
:
3
)
...
...
metal/paddle-mobile/paddle-mobile/MobileNetSSD.swift
浏览文件 @
32efc50c
...
@@ -27,6 +27,18 @@ public class MobileNet_ssd_hand: Net{
...
@@ -27,6 +27,18 @@ public class MobileNet_ssd_hand: Net{
dim
=
(
n
:
1
,
h
:
300
,
w
:
300
,
c
:
3
)
dim
=
(
n
:
1
,
h
:
300
,
w
:
300
,
c
:
3
)
}
}
@objc
override
public
init
(
device
:
MTLDevice
,
paramPointer
:
UnsafeMutableRawPointer
,
paramSize
:
Int
,
modePointer
:
UnsafeMutableRawPointer
,
modelSize
:
Int
)
{
super
.
init
(
device
:
device
,
paramPointer
:
paramPointer
,
paramSize
:
paramSize
,
modePointer
:
modePointer
,
modelSize
:
modelSize
)
means
=
[
123.68
,
116.78
,
103.94
]
scale
=
0.017
except
=
2
modelPath
=
""
paramPath
=
""
modelDir
=
""
preprocessKernel
=
MobilenetssdPreProccess
.
init
(
device
:
device
)
dim
=
(
n
:
1
,
h
:
300
,
w
:
300
,
c
:
3
)
}
class
MobilenetssdPreProccess
:
CusomKernel
{
class
MobilenetssdPreProccess
:
CusomKernel
{
init
(
device
:
MTLDevice
)
{
init
(
device
:
MTLDevice
)
{
let
s
=
CusomKernel
.
Shape
.
init
(
inWidth
:
300
,
inHeight
:
300
,
inChannel
:
3
)
let
s
=
CusomKernel
.
Shape
.
init
(
inWidth
:
300
,
inHeight
:
300
,
inChannel
:
3
)
...
...
metal/paddle-mobile/paddle-mobile/Net.swift
浏览文件 @
32efc50c
...
@@ -16,15 +16,15 @@
...
@@ -16,15 +16,15 @@
import
Foundation
import
Foundation
public
class
ResultHolder
:
NSObject
{
public
class
ResultHolder
:
NSObject
{
public
let
result
:
UnsafeMutablePointer
<
Float32
>
?
@objc
public
let
result
:
UnsafeMutablePointer
<
Float32
>
?
public
let
capacity
:
Int
@objc
public
let
capacity
:
Int
init
(
inResult
:
UnsafeMutablePointer
<
Float32
>
?,
inCapacity
:
Int
)
{
init
(
inResult
:
UnsafeMutablePointer
<
Float32
>
?,
inCapacity
:
Int
)
{
result
=
inResult
result
=
inResult
capacity
=
inCapacity
capacity
=
inCapacity
}
}
public
func
releasePointer
()
{
@objc
public
func
releasePointer
()
{
result
?
.
deinitialize
(
count
:
capacity
)
result
?
.
deinitialize
(
count
:
capacity
)
result
?
.
deallocate
()
result
?
.
deallocate
()
}
}
...
@@ -43,6 +43,14 @@ public class Net: NSObject {
...
@@ -43,6 +43,14 @@ public class Net: NSObject {
var
modelPath
:
String
=
""
var
modelPath
:
String
=
""
var
paramPath
:
String
=
""
var
paramPath
:
String
=
""
var
modelDir
:
String
=
""
var
modelDir
:
String
=
""
@objc
public
init
(
device
:
MTLDevice
,
paramPointer
:
UnsafeMutableRawPointer
,
paramSize
:
Int
,
modePointer
:
UnsafeMutableRawPointer
,
modelSize
:
Int
)
{
self
.
paramPointer
=
paramPointer
self
.
paramSize
=
paramSize
self
.
modelPointer
=
modePointer
self
.
modelSize
=
modelSize
super
.
init
()
}
public
func
resultStr
(
res
:
ResultHolder
)
->
String
{
public
func
resultStr
(
res
:
ResultHolder
)
->
String
{
fatalError
()
fatalError
()
...
...
metal/paddle-mobile/paddle-mobile/PaddleMobile.swift
浏览文件 @
32efc50c
...
@@ -24,6 +24,7 @@ class ScaleKernel: CusomKernel {
...
@@ -24,6 +24,7 @@ class ScaleKernel: CusomKernel {
fatalError
(
" unsupport "
)
fatalError
(
" unsupport "
)
}
}
}
}
}
}
public
class
Runner
:
NSObject
{
public
class
Runner
:
NSObject
{
...
@@ -75,8 +76,10 @@ public class Runner: NSObject {
...
@@ -75,8 +76,10 @@ public class Runner: NSObject {
}
}
let
loader
=
Loader
<
Float32
>.
init
()
let
loader
=
Loader
<
Float32
>.
init
()
do
{
do
{
program
=
try
loader
.
load
(
device
:
inDevice
,
modelPath
:
net
.
modelPath
,
paraPath
:
net
.
paramPath
)
program
=
try
loader
.
load
(
device
:
inDevice
,
paramPointer
:
net
.
paramPointer
!
,
paramSize
:
net
.
paramSize
,
modePointer
:
net
.
modelPointer
!
,
modelSize
:
net
.
modelSize
)
// program = try loader.load(device: inDevice, modelPath: net.modelPath, paraPath: net.paramPath)
net
.
updateProgram
(
program
:
program
!
)
net
.
updateProgram
(
program
:
program
!
)
executor
=
try
Executor
<
Float32
>.
init
(
inDevice
:
inDevice
,
inQueue
:
inQueue
,
inProgram
:
program
!
)
executor
=
try
Executor
<
Float32
>.
init
(
inDevice
:
inDevice
,
inQueue
:
inQueue
,
inProgram
:
program
!
)
}
catch
let
error
{
}
catch
let
error
{
print
(
error
)
print
(
error
)
...
...
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.h
浏览文件 @
32efc50c
...
@@ -37,6 +37,7 @@ typedef enum : NSUInteger {
...
@@ -37,6 +37,7 @@ typedef enum : NSUInteger {
*/
*/
@property
(
strong
,
nonatomic
)
NSArray
<
NSNumber
*>
*
dims
;
@property
(
strong
,
nonatomic
)
NSArray
<
NSNumber
*>
*
dims
;
/*
/*
* 模型参数内存地址
* 模型参数内存地址
*/
*/
...
@@ -83,7 +84,7 @@ typedef enum : NSUInteger {
...
@@ -83,7 +84,7 @@ typedef enum : NSUInteger {
/*
/*
* 清理内存
* 清理内存
*/
*/
-
(
void
)
cl
r
ear
;
-
(
void
)
clear
;
@end
@end
...
...
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m
浏览文件 @
32efc50c
...
@@ -7,22 +7,56 @@
...
@@ -7,22 +7,56 @@
//
//
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#import "PaddleMobileGPU.h"
#import "PaddleMobileGPU.h"
#import "paddle_mobile/paddle_mobile-Swift.h"
#import "paddle_mobile.h"
#import <paddle_mobile/paddle_mobile-Swift.h>
@implementation
PaddleMobileGPU
@implementation
ModelConfig
@end
-
(
void
)
clrear
{
@interface
PaddleMobileGPU
()
{
Runner
*
runner
;
}
@end
// [[ResultHolder alloc] init];
@implementation
PaddleMobileGPU
// [[TestClass alloc] init];
// [[TestClass alloc] initWithI:<#(NSInteger)#>]
// ResultHolder;
-
(
instancetype
)
initWithCommandQueue
:(
id
<
MTLCommandQueue
>
)
queue
net
:(
NetType
)
netType
modelConfig
:(
ModelConfig
*
)
config
{
self
=
[
super
init
];
if
(
self
)
{
Net
*
net
=
nil
;
if
(
netType
==
GenetType
)
{
net
=
[[
Genet
alloc
]
initWithDevice
:
queue
.
device
paramPointer
:
config
.
paramPointer
paramSize
:
config
.
paramSize
modePointer
:
config
.
modelPointer
modelSize
:
config
.
modelSize
];
}
else
if
(
netType
==
MobileNetSSDType
)
{
net
=
[[
MobileNet_ssd_hand
alloc
]
initWithDevice
:
queue
.
device
paramPointer
:
config
.
paramPointer
paramSize
:
config
.
paramSize
modePointer
:
config
.
modelPointer
modelSize
:
config
.
modelSize
];
}
else
if
(
netType
==
MobileNetType
)
{
}
runner
=
[[
Runner
alloc
]
initInNet
:
net
commandQueue
:
queue
inPlatform
:
PlatformGPU
];
}
return
self
;
}
}
@end
-
(
BOOL
)
load
{
return
[
runner
load
];
}
-
(
void
)
predict
:(
id
<
MTLTexture
>
)
texture
withCompletion
:(
void
(
^
)(
BOOL
,
NSArray
<
NSNumber
*>
*
))
completion
{
[
runner
predictWithTexture
:
texture
completion
:
^
(
BOOL
success
,
ResultHolder
*
_Nullable
result
)
{
NSMutableArray
<
NSNumber
*>
*
resultArray
=
[
NSMutableArray
arrayWithCapacity
:
result
.
capacity
];
for
(
int
i
=
0
;
i
<
result
.
capacity
;
++
i
)
{
[
resultArray
addObject
:[
NSNumber
numberWithFloat
:
result
.
result
[
i
]]];
}
completion
(
success
,
resultArray
);
[
result
releasePointer
];
}];
// [runner predictWithTexture:texture completion:completion];
}
-
(
void
)
clear
{
[
runner
clear
];
}
@end
metal/paddle-mobile/paddle-mobile/Program/Program.swift
浏览文件 @
32efc50c
...
@@ -23,4 +23,9 @@ public class Program {
...
@@ -23,4 +23,9 @@ public class Program {
paramPath
=
inParamPath
paramPath
=
inParamPath
scope
=
inScope
scope
=
inScope
}
}
init
(
inProgramDesc
:
ProgramDesc
,
inScope
:
Scope
)
{
programDesc
=
inProgramDesc
scope
=
inScope
paramPath
=
""
}
}
}
metal/paddle-mobile/paddle-mobile/framework/Loader.swift
浏览文件 @
32efc50c
...
@@ -93,13 +93,57 @@ public class Loader<P: PrecisionType> {
...
@@ -93,13 +93,57 @@ public class Loader<P: PrecisionType> {
fclose
(
file
)
fclose
(
file
)
}
}
}
}
public
init
(){}
class
ParaLoaderWithPointer
{
public
func
load
(
device
:
MTLDevice
,
modelPath
:
String
,
paraPath
:
String
)
throws
->
Program
{
var
paramPointer
:
UnsafeMutableRawPointer
let
paramSize
:
Int
var
nowIndex
:
Int
init
(
pPointer
:
UnsafeMutableRawPointer
,
pSize
:
Int
)
throws
{
paramPointer
=
UnsafeMutableRawPointer
.
init
(
pPointer
)
paramSize
=
pSize
nowIndex
=
0
}
guard
let
modelData
=
try
?
Data
.
init
(
contentsOf
:
URL
.
init
(
fileURLWithPath
:
modelPath
))
else
{
func
read
(
tensor
:
Tensor
<
P
>
)
throws
{
throw
PaddleMobileError
.
loaderError
(
message
:
"load "
+
modelPath
+
" failed !"
)
guard
nowIndex
<=
paramSize
else
{
throw
PaddleMobileError
.
loaderError
(
message
:
"out of the file range"
)
}
}
var
readerIndex
:
Int
=
0
func
pointerReader
<
T
>
(
type
:
T
.
Type
)
->
T
{
let
ptr
=
UnsafeMutablePointer
<
T
>.
allocate
(
capacity
:
MemoryLayout
<
T
>.
size
)
memcpy
(
ptr
,
paramPointer
.
advanced
(
by
:
Int
(
readerIndex
)),
MemoryLayout
<
T
>.
size
)
nowIndex
+=
MemoryLayout
<
T
>.
size
readerIndex
+=
MemoryLayout
<
T
>.
size
let
pointee
=
ptr
.
pointee
ptr
.
deinitialize
(
count
:
MemoryLayout
<
UInt32
>.
size
)
ptr
.
deallocate
()
return
pointee
}
let
_
=
pointerReader
(
type
:
UInt32
.
self
)
let
lodLevel
=
pointerReader
(
type
:
UInt64
.
self
)
for
_
in
0
..<
lodLevel
{
let
size
=
pointerReader
(
type
:
UInt64
.
self
)
for
_
in
0
..<
Int
(
size
/
UInt64
(
MemoryLayout
<
size_t
>.
size
)){
_
=
pointerReader
(
type
:
size_t
.
self
)
}
}
let
_
=
pointerReader
(
type
:
UInt32
.
self
)
let
tensorDescSize
=
pointerReader
(
type
:
Int32
.
self
)
paramPointer
=
paramPointer
.
advanced
(
by
:
Int
(
readerIndex
))
paramPointer
=
paramPointer
.
advanced
(
by
:
Int
(
tensorDescSize
))
nowIndex
+=
Int
(
tensorDescSize
)
let
_
=
memcpy
(
tensor
.
data
.
pointer
,
paramPointer
,
tensor
.
data
.
size
)
paramPointer
=
paramPointer
.
advanced
(
by
:
Int
(
tensor
.
data
.
size
))
nowIndex
+=
tensor
.
data
.
size
}
deinit
{
}
}
public
init
(){}
func
loadModelandParam
(
_
device
:
MTLDevice
,
_
modelData
:
Data
,
_
paraLoaderPointer
:
ParaLoaderWithPointer
?,
_
paraLoader
:
ParaLoader
?)
throws
->
Program
{
do
{
do
{
let
protoProgram
=
try
PaddleMobile_Framework_Proto_ProgramDesc
.
init
(
let
protoProgram
=
try
PaddleMobile_Framework_Proto_ProgramDesc
.
init
(
serializedData
:
modelData
)
serializedData
:
modelData
)
...
@@ -108,10 +152,6 @@ public class Loader<P: PrecisionType> {
...
@@ -108,10 +152,6 @@ public class Loader<P: PrecisionType> {
let
programDesc
=
ProgramOptimize
<
P
>.
init
()
.
optimize
(
originProgramDesc
:
originProgramDesc
)
let
programDesc
=
ProgramOptimize
<
P
>.
init
()
.
optimize
(
originProgramDesc
:
originProgramDesc
)
print
(
programDesc
)
print
(
programDesc
)
guard
let
paraLoader
=
try
?
ParaLoader
.
init
(
paramPath
:
paraPath
)
else
{
throw
PaddleMobileError
.
loaderError
(
message
:
"load para error"
)
}
guard
programDesc
.
blocks
.
count
>
0
else
{
guard
programDesc
.
blocks
.
count
>
0
else
{
throw
PaddleMobileError
.
loaderError
(
message
:
"count of blocks must greater than 0"
)
throw
PaddleMobileError
.
loaderError
(
message
:
"count of blocks must greater than 0"
)
}
}
...
@@ -155,11 +195,17 @@ public class Loader<P: PrecisionType> {
...
@@ -155,11 +195,17 @@ public class Loader<P: PrecisionType> {
let
dim
=
Dim
.
init
(
inDim
:
dimArr
)
let
dim
=
Dim
.
init
(
inDim
:
dimArr
)
let
tensor
=
Tensor
<
P
>.
init
(
inDim
:
dim
,
inLayout
:
tensorDesc
.
dataLayout
)
let
tensor
=
Tensor
<
P
>.
init
(
inDim
:
dim
,
inLayout
:
tensorDesc
.
dataLayout
)
do
{
do
{
try
paraLoader
.
read
(
tensor
:
tensor
)
if
paraLoaderPointer
!=
nil
{
try
paraLoaderPointer
!.
read
(
tensor
:
tensor
)
}
if
paraLoader
!=
nil
{
try
paraLoader
!.
read
(
tensor
:
tensor
)
}
}
catch
let
error
{
}
catch
let
error
{
throw
error
throw
error
}
}
// tensor.convert(to: DataLayout.NHWC())
// tensor.convert(to: DataLayout.NHWC())
// tensor.initBuffer(device: device)
// tensor.initBuffer(device: device)
scope
[
varDesc
.
name
]
=
tensor
scope
[
varDesc
.
name
]
=
tensor
}
else
{
}
else
{
...
@@ -175,11 +221,39 @@ public class Loader<P: PrecisionType> {
...
@@ -175,11 +221,39 @@ public class Loader<P: PrecisionType> {
}
}
}
}
let
program
=
Program
.
init
(
inProgramDesc
:
programDesc
,
in
ParamPath
:
paraPath
,
in
Scope
:
scope
)
let
program
=
Program
.
init
(
inProgramDesc
:
programDesc
,
inScope
:
scope
)
return
program
return
program
}
catch
_
{
}
catch
_
{
throw
PaddleMobileError
.
loaderError
(
message
:
"protobuf decoder error"
)
throw
PaddleMobileError
.
loaderError
(
message
:
"protobuf decoder error"
)
}
}
}
}
public
func
load
(
device
:
MTLDevice
,
paramPointer
:
UnsafeMutableRawPointer
,
paramSize
:
Int
,
modePointer
:
UnsafeMutableRawPointer
,
modelSize
:
Int
)
throws
->
Program
{
let
modelData
=
Data
.
init
(
bytes
:
modePointer
,
count
:
modelSize
)
guard
let
paraLoader
=
try
?
ParaLoaderWithPointer
.
init
(
pPointer
:
paramPointer
,
pSize
:
paramSize
)
else
{
throw
PaddleMobileError
.
loaderError
(
message
:
"load para error"
)
}
do
{
let
program
=
try
loadModelandParam
(
device
,
modelData
,
paraLoader
,
nil
)
return
program
}
catch
let
error
{
throw
error
}
}
public
func
load
(
device
:
MTLDevice
,
modelPath
:
String
,
paraPath
:
String
)
throws
->
Program
{
guard
let
modelData
=
try
?
Data
.
init
(
contentsOf
:
URL
.
init
(
fileURLWithPath
:
modelPath
))
else
{
throw
PaddleMobileError
.
loaderError
(
message
:
"load "
+
modelPath
+
" failed !"
)
}
guard
let
paraLoader
=
try
?
ParaLoader
.
init
(
paramPath
:
paraPath
)
else
{
throw
PaddleMobileError
.
loaderError
(
message
:
"load para error"
)
}
do
{
let
program
=
try
loadModelandParam
(
device
,
modelData
,
nil
,
paraLoader
)
return
program
}
catch
let
error
{
throw
error
}
}
}
}
metal/paddle-mobile/paddle-mobile/paddle_mobile.h
浏览文件 @
32efc50c
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#import "PaddleMobile.h"
#import "PaddleMobile.h"
#import "CPUCompute.h"
#import "CPUCompute.h"
#import "PaddleMobileGPU.h"
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
//! Project version number for paddle_mobile.
//! Project version number for paddle_mobile.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录