Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
b737f62a
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看板
提交
b737f62a
编写于
8月 29, 2018
作者:
D
dolphin8
提交者:
GitHub
8月 29, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #865 from dolphin8/metal
elementwise_add
上级
4259b1ce
5e72f582
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
1 deletion
+20
-1
metal/paddle-mobile/paddle-mobile/Executor.swift
metal/paddle-mobile/paddle-mobile/Executor.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Operators/ConcatOp.swift
metal/paddle-mobile/paddle-mobile/Operators/ConcatOp.swift
+1
-0
metal/paddle-mobile/paddle-mobile/Operators/ElementwiseAddOp.swift
...dle-mobile/paddle-mobile/Operators/ElementwiseAddOp.swift
+17
-0
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ElementwiseAddKernel.swift
...addle-mobile/Operators/Kernels/ElementwiseAddKernel.swift
+1
-0
未找到文件。
metal/paddle-mobile/paddle-mobile/Executor.swift
浏览文件 @
b737f62a
...
...
@@ -14,7 +14,7 @@
import
Foundation
let
testTo
=
7
let
testTo
=
12
public
class
ResultHolder
<
P
:
PrecisionType
>
{
public
let
dim
:
[
Int
]
...
...
metal/paddle-mobile/paddle-mobile/Operators/ConcatOp.swift
浏览文件 @
b737f62a
...
...
@@ -68,6 +68,7 @@ class ConcatOp<P: PrecisionType>: Operator<ConcatKernel<P>, ConcatParam<P>>, Run
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
(
para
.
output
.
metalTexture
.
toTensor
(
dim
:
(
n
:
para
.
output
.
tensorDim
[
0
],
c
:
para
.
output
.
tensorDim
[
1
],
h
:
para
.
output
.
tensorDim
[
2
],
w
:
para
.
output
.
tensorDim
[
3
]))
.
strideArray
())
}
}
...
...
metal/paddle-mobile/paddle-mobile/Operators/ElementwiseAddOp.swift
浏览文件 @
b737f62a
...
...
@@ -56,7 +56,24 @@ class ElementwiseAddOp<P: PrecisionType>: Operator<ElementwiseAddKernel<P>, Elem
// para.output.dim = para.input.dim
}
func
delogOutput
()
{
print
(
"
\(
type
)
inputX: "
)
print
(
para
.
inputX
.
metalTexture
.
toTensor
(
dim
:
(
n
:
para
.
inputX
.
tensorDim
[
0
],
c
:
para
.
inputX
.
tensorDim
[
1
],
h
:
para
.
inputX
.
tensorDim
[
2
],
w
:
para
.
inputX
.
tensorDim
[
3
]))
.
strideArray
())
print
(
"
\(
type
)
inputY: "
)
print
(
para
.
inputY
.
metalTexture
.
toTensor
(
dim
:
(
n
:
para
.
inputY
.
tensorDim
[
0
],
c
:
para
.
inputY
.
tensorDim
[
1
],
h
:
para
.
inputY
.
tensorDim
[
2
],
w
:
para
.
inputY
.
tensorDim
[
3
]))
.
strideArray
())
print
(
"
\(
type
)
output: "
)
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
(
para
.
output
.
metalTexture
.
toTensor
(
dim
:
(
n
:
para
.
output
.
tensorDim
[
0
],
c
:
para
.
output
.
tensorDim
[
1
],
h
:
para
.
output
.
tensorDim
[
2
],
w
:
para
.
output
.
tensorDim
[
3
]))
.
strideArray
())
}
func
runImpl
(
device
:
MTLDevice
,
buffer
:
MTLCommandBuffer
)
throws
{
do
{
try
kernel
.
compute
(
commandBuffer
:
buffer
,
param
:
para
)
}
catch
let
error
{
throw
error
}
}
}
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ElementwiseAddKernel.swift
浏览文件 @
b737f62a
...
...
@@ -55,6 +55,7 @@ class ElementwiseAddKernel<P: PrecisionType>: Kernel, Computable {
}
emp
.
yoff
=
4
-
Int32
(
param
.
inputY
.
tensorDim
.
cout
())
if
(
param
.
inputX
.
dim
==
param
.
inputY
.
dim
)
&&
(
param
.
inputX
.
transpose
==
param
.
inputY
.
transpose
)
{
print
(
"===> elementwise_add fast!!!"
)
emp
.
fast
=
1
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录