Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
320a6000
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看板
提交
320a6000
编写于
8月 27, 2018
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
b1ffc144
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
52 addition
and
18 deletion
+52
-18
metal/paddle-mobile/paddle-mobile/Executor.swift
metal/paddle-mobile/paddle-mobile/Executor.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Operators/BoxcoderOp.swift
metal/paddle-mobile/paddle-mobile/Operators/BoxcoderOp.swift
+29
-5
metal/paddle-mobile/paddle-mobile/Operators/ConcatOp.swift
metal/paddle-mobile/paddle-mobile/Operators/ConcatOp.swift
+2
-0
metal/paddle-mobile/paddle-mobile/Operators/Kernels/PriorBoxKernel.swift
...bile/paddle-mobile/Operators/Kernels/PriorBoxKernel.swift
+10
-0
metal/paddle-mobile/paddle-mobile/Operators/Kernels/metal/ReshapeKernel.metal
...paddle-mobile/Operators/Kernels/metal/ReshapeKernel.metal
+10
-12
未找到文件。
metal/paddle-mobile/paddle-mobile/Executor.swift
浏览文件 @
320a6000
...
...
@@ -14,7 +14,7 @@
import
Foundation
let
testTo
=
9
3
let
testTo
=
9
4
public
class
ResultHolder
<
P
:
PrecisionType
>
{
public
let
dim
:
[
Int
]
...
...
metal/paddle-mobile/paddle-mobile/Operators/BoxcoderOp.swift
浏览文件 @
320a6000
...
...
@@ -61,14 +61,38 @@
}
func
delogOutput
()
{
let
outputArray
=
para
.
output
.
metalTexture
.
floatArray
{
(
o
:
Float32
)
->
Float32
in
return
o
}
// let outputArray = para.output.metalTexture.floatArray { (o: Float32) -> Float32 in
// return o
// }
let
priorBoxOriginDim
=
para
.
priorBox
.
originDim
let
priorBoxArray
=
para
.
priorBox
.
metalTexture
.
realNHWC
(
dim
:
(
n
:
priorBoxOriginDim
[
0
],
h
:
priorBoxOriginDim
[
1
],
w
:
priorBoxOriginDim
[
2
],
c
:
priorBoxOriginDim
[
3
]))
print
(
" prior box "
)
print
(
priorBoxArray
.
strideArray
())
let
priorBoxVarOriginDim
=
para
.
priorBoxVar
.
originDim
let
priorBoxVarArray
=
para
.
priorBoxVar
.
metalTexture
.
realNHWC
(
dim
:
(
n
:
priorBoxVarOriginDim
[
0
],
h
:
priorBoxVarOriginDim
[
1
],
w
:
priorBoxVarOriginDim
[
2
],
c
:
priorBoxVarOriginDim
[
3
]))
print
(
" prior box var "
)
print
(
priorBoxVarArray
.
strideArray
())
let
targetBoxOriginDim
=
para
.
targetBox
.
originDim
let
targetBoxArray
=
para
.
targetBox
.
metalTexture
.
realNHWC
(
dim
:
(
n
:
targetBoxOriginDim
[
0
],
h
:
targetBoxOriginDim
[
1
],
w
:
targetBoxOriginDim
[
2
],
c
:
targetBoxOriginDim
[
3
]))
print
(
" target box "
)
print
(
targetBoxArray
.
strideArray
())
let
originDim
=
para
.
output
.
originDim
let
outputArray
=
para
.
output
.
metalTexture
.
realNHWC
(
dim
:
(
n
:
originDim
[
0
],
h
:
originDim
[
1
],
w
:
originDim
[
2
],
c
:
originDim
[
3
]))
print
(
outputArray
.
strideArray
())
// print(outputArray.strideArray())
//box_coder_0.tmp_0
// writeToLibrary(fileName: "boxcoder_output", array: outputArray)
print
(
para
.
output
.
metalTexture
)
print
(
" write done "
)
//
print(para.output.metalTexture)
//
print(" write done ")
}
}
...
...
metal/paddle-mobile/paddle-mobile/Operators/ConcatOp.swift
浏览文件 @
320a6000
...
...
@@ -60,6 +60,8 @@ class ConcatOp<P: PrecisionType>: Operator<ConcatKernel<P>, ConcatParam<P>>, Run
func
delogOutput
()
{
let
originDim
=
para
.
output
.
originDim
let
outputArray
=
para
.
output
.
metalTexture
.
realNHWC
(
dim
:
(
n
:
originDim
[
0
],
h
:
originDim
[
1
],
w
:
originDim
[
2
],
c
:
originDim
[
3
]))
print
(
outputArray
.
strideArray
())
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/PriorBoxKernel.swift
浏览文件 @
320a6000
...
...
@@ -35,8 +35,18 @@ class PriorBoxKernel<P: PrecisionType>: Kernel, Computable{
required
init
(
device
:
MTLDevice
,
param
:
PriorBoxParam
<
P
>
)
{
super
.
init
(
device
:
device
,
inFunctionName
:
"prior_box"
)
param
.
output
.
initTexture
(
device
:
device
,
inTranspose
:
[
2
,
0
,
1
,
3
])
param
.
outputVariances
.
initTexture
(
device
:
device
,
inTranspose
:
[
2
,
0
,
1
,
3
])
let
n
=
1
let
h
=
param
.
output
.
dim
[
1
]
let
w
=
param
.
output
.
dim
[
2
]
let
c
=
param
.
output
.
dim
[
3
]
*
param
.
output
.
dim
[
0
]
param
.
output
.
dim
=
Dim
.
init
(
inDim
:
[
n
,
h
,
w
,
c
])
param
.
output
.
transpose
=
[
0
,
1
,
2
,
3
]
let
imageWidth
=
Float32
(
param
.
inputImage
.
originDim
[
3
])
let
imageHeight
=
Float32
(
param
.
inputImage
.
originDim
[
2
])
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/metal/ReshapeKernel.metal
浏览文件 @
320a6000
...
...
@@ -102,16 +102,14 @@ kernel void reshape(texture2d_array<float, access::read> inTexture [[texture(0)]
outTexture.write(r, gid.xy, gid.z);
}
//
//kernel void reshape_half(texture2d_array<half, access::read> inTexture [[texture(0)]],
// texture2d_array<half, access::write> outTexture [[texture(1)]],
// uint3 gid [[thread_position_in_grid]]) {
// if (gid.x >= outTexture.get_width() ||
// gid.y >= outTexture.get_height() ||
// gid.z >= outTexture.get_array_size()) return;
//
// half4 r = inTexture.read(uint2(0, 0), gid.x);
// outTexture.write(r, gid.xy, gid.z);
//}
kernel void reshape_half(texture2d_array<half, access::read> inTexture [[texture(0)]],
texture2d_array<half, access::write> outTexture [[texture(1)]],
uint3 gid [[thread_position_in_grid]]) {
if (gid.x >= outTexture.get_width() ||
gid.y >= outTexture.get_height() ||
gid.z >= outTexture.get_array_size()) return;
half4 r = inTexture.read(uint2(0, 0), gid.x);
outTexture.write(r, gid.xy, gid.z);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录