Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
80fbb9f4
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看板
提交
80fbb9f4
编写于
8月 27, 2018
作者:
D
dolphin8
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reshape infer shape
上级
88c6f04b
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
26 addition
and
4 deletion
+26
-4
metal/paddle-mobile/paddle-mobile/Operators/ReshapeOp.swift
metal/paddle-mobile/paddle-mobile/Operators/ReshapeOp.swift
+24
-2
metal/paddle-mobile/paddle-mobile/framework/Texture.swift
metal/paddle-mobile/paddle-mobile/framework/Texture.swift
+2
-2
未找到文件。
metal/paddle-mobile/paddle-mobile/Operators/ReshapeOp.swift
浏览文件 @
80fbb9f4
...
@@ -20,14 +20,36 @@ class ReshapeParam<P: PrecisionType>: OpParam {
...
@@ -20,14 +20,36 @@ class ReshapeParam<P: PrecisionType>: OpParam {
do
{
do
{
input
=
try
ReshapeParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
input
=
try
ReshapeParam
.
inputX
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
ReshapeParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
output
=
try
ReshapeParam
.
outputOut
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
// shape = output.dim
shape
=
try
ReshapeParam
.
getAttr
(
key
:
"shape"
,
attrs
:
opDesc
.
attrs
)
var
s
:
[
Int
]
=
shape
.
map
{
Int
(
$0
)
}
var
di
=
-
1
var
ml
=
1
for
i
in
0
..<
s
.
count
{
if
s
[
i
]
==
-
1
{
di
=
i
continue
}
ml
*=
s
[
i
]
}
if
di
>=
0
{
s
[
di
]
=
input
.
dim
.
numel
()
/
ml
}
output
.
tensorDim
=
Dim
.
init
(
inDim
:
s
)
var
dim
:
[
Int
]
=
[
1
,
1
,
1
,
1
]
for
i
in
0
..<
s
.
count
{
dim
[
4
-
s
.
count
+
i
]
=
s
[
i
]
}
output
.
originDim
=
Dim
.
init
(
inDim
:
dim
)
output
.
dim
=
output
.
originDim
inplace
=
try
ReshapeParam
.
getAttr
(
key
:
"inplace"
,
attrs
:
opDesc
.
attrs
)
inplace
=
try
ReshapeParam
.
getAttr
(
key
:
"inplace"
,
attrs
:
opDesc
.
attrs
)
}
catch
let
error
{
}
catch
let
error
{
throw
error
throw
error
}
}
}
}
let
input
:
Texture
<
P
>
let
input
:
Texture
<
P
>
// let shape: [Int
]
let
shape
:
[
Int32
]
let
inplace
:
Bool
let
inplace
:
Bool
var
output
:
Texture
<
P
>
var
output
:
Texture
<
P
>
}
}
...
...
metal/paddle-mobile/paddle-mobile/framework/Texture.swift
浏览文件 @
80fbb9f4
...
@@ -40,8 +40,8 @@ extension InputTexture {
...
@@ -40,8 +40,8 @@ extension InputTexture {
public
class
Texture
<
P
:
PrecisionType
>
:
Tensorial
{
public
class
Texture
<
P
:
PrecisionType
>
:
Tensorial
{
var
dim
:
Dim
var
dim
:
Dim
p
rivate(set)
p
ublic
var
tensorDim
:
Dim
public
var
tensorDim
:
Dim
p
rivate(set)
p
ublic
var
originDim
:
Dim
public
var
originDim
:
Dim
private
var
textureDesc
:
MTLTextureDescriptor
!
private
var
textureDesc
:
MTLTextureDescriptor
!
public
var
metalTexture
:
MTLTexture
!
public
var
metalTexture
:
MTLTexture
!
var
transpose
:
[
Int
]
=
[
0
,
1
,
2
,
3
]
var
transpose
:
[
Int
]
=
[
0
,
1
,
2
,
3
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录