Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
3df1380c
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看板
提交
3df1380c
编写于
7月 10, 2018
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
formt license header
上级
ea8cbd5b
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
224 addition
and
125 deletion
+224
-125
metal/paddle-mobile/paddle-mobile/Common/MetalExtension.swift
...l/paddle-mobile/paddle-mobile/Common/MetalExtension.swift
+13
-7
metal/paddle-mobile/paddle-mobile/Executor.swift
metal/paddle-mobile/paddle-mobile/Executor.swift
+11
-11
metal/paddle-mobile/paddle-mobile/Operators/ConvAddBatchNormReluOp.swift
...bile/paddle-mobile/Operators/ConvAddBatchNormReluOp.swift
+19
-8
metal/paddle-mobile/paddle-mobile/Operators/ConvAddOp.swift
metal/paddle-mobile/paddle-mobile/Operators/ConvAddOp.swift
+14
-8
metal/paddle-mobile/paddle-mobile/Operators/Kernels/BatchNormKernel.swift
...ile/paddle-mobile/Operators/Kernels/BatchNormKernel.swift
+13
-7
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvAddBatchNormReluKernel.swift
...mobile/Operators/Kernels/ConvAddBatchNormReluKernel.swift
+15
-7
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvAddKernel.swift
...obile/paddle-mobile/Operators/Kernels/ConvAddKernel.swift
+13
-7
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvKernel.metal
...e-mobile/paddle-mobile/Operators/Kernels/ConvKernel.metal
+13
-7
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvKernel.swift
...e-mobile/paddle-mobile/Operators/Kernels/ConvKernel.swift
+13
-7
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ElementwiseAddKernel.swift
...addle-mobile/Operators/Kernels/ElementwiseAddKernel.swift
+13
-7
metal/paddle-mobile/paddle-mobile/Operators/Kernels/Texture2DTo2DArrayKernel.swift
...e-mobile/Operators/Kernels/Texture2DTo2DArrayKernel.swift
+13
-7
metal/paddle-mobile/paddle-mobile/Operators/PoolOp.swift
metal/paddle-mobile/paddle-mobile/Operators/PoolOp.swift
+13
-7
metal/paddle-mobile/paddle-mobile/Operators/ReshapeOp.swift
metal/paddle-mobile/paddle-mobile/Operators/ReshapeOp.swift
+13
-7
metal/paddle-mobile/paddle-mobile/Operators/SoftmaxOp.swift
metal/paddle-mobile/paddle-mobile/Operators/SoftmaxOp.swift
+13
-7
metal/paddle-mobile/paddle-mobile/Program/OpDesc.swift
metal/paddle-mobile/paddle-mobile/Program/OpDesc.swift
+1
-1
metal/paddle-mobile/paddle-mobile/Program/ProgramOptimize.swift
...paddle-mobile/paddle-mobile/Program/ProgramOptimize.swift
+16
-9
metal/paddle-mobile/paddle-mobile/framework/Tensor.swift
metal/paddle-mobile/paddle-mobile/framework/Tensor.swift
+18
-11
未找到文件。
metal/paddle-mobile/paddle-mobile/Common/MetalExtension.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// MetalExtension.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/2.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
...
metal/paddle-mobile/paddle-mobile/Executor.swift
浏览文件 @
3df1380c
...
@@ -55,17 +55,8 @@ public class Executor<P: PrecisionType> {
...
@@ -55,17 +55,8 @@ public class Executor<P: PrecisionType> {
device
=
inDevice
device
=
inDevice
queue
=
inQueue
queue
=
inQueue
for
block
in
inProgram
.
programDesc
.
blocks
{
for
block
in
inProgram
.
programDesc
.
blocks
{
for
i
in
0
..<
7
{
// for i in 0..<2 {
let
op
=
block
.
ops
[
i
]
// let op = block.ops[i]
do
{
let
op
=
try
OpCreator
<
P
>.
shared
.
creat
(
device
:
inDevice
,
opDesc
:
op
,
scope
:
inProgram
.
scope
)
op
.
inferShape
()
ops
.
append
(
op
)
}
catch
let
error
{
throw
error
}
}
// for op in block.ops {
// do {
// do {
// let op = try OpCreator<P>.shared.creat(device: inDevice, opDesc: op, scope: inProgram.scope)
// let op = try OpCreator<P>.shared.creat(device: inDevice, opDesc: op, scope: inProgram.scope)
// op.inferShape()
// op.inferShape()
...
@@ -74,6 +65,15 @@ public class Executor<P: PrecisionType> {
...
@@ -74,6 +65,15 @@ public class Executor<P: PrecisionType> {
// throw error
// throw error
// }
// }
// }
// }
for
op
in
block
.
ops
{
do
{
let
op
=
try
OpCreator
<
P
>.
shared
.
creat
(
device
:
inDevice
,
opDesc
:
op
,
scope
:
inProgram
.
scope
)
op
.
inferShape
()
ops
.
append
(
op
)
}
catch
let
error
{
throw
error
}
}
}
}
}
}
...
...
metal/paddle-mobile/paddle-mobile/Operators/ConvAddBatchNormReluOp.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// ConvAddBatchNormReluOp.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/8.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
@@ -14,7 +20,7 @@ class ConvAddBatchNormReluParam<P: PrecisionType>: OpParam {
...
@@ -14,7 +20,7 @@ class ConvAddBatchNormReluParam<P: PrecisionType>: OpParam {
do
{
do
{
filter
=
try
ConvAddBatchNormReluParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
filter
=
try
ConvAddBatchNormReluParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
input
=
try
ConvAddBatchNormReluParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
input
=
try
ConvAddBatchNormReluParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
ConvAddBatchNormReluParam
.
output
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
output
=
try
ConvAddBatchNormReluParam
.
output
Out
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
stride
=
try
ConvAddBatchNormReluParam
.
getAttr
(
key
:
"strides"
,
attrs
:
opDesc
.
attrs
)
stride
=
try
ConvAddBatchNormReluParam
.
getAttr
(
key
:
"strides"
,
attrs
:
opDesc
.
attrs
)
paddings
=
try
ConvAddBatchNormReluParam
.
getAttr
(
key
:
"paddings"
,
attrs
:
opDesc
.
attrs
)
paddings
=
try
ConvAddBatchNormReluParam
.
getAttr
(
key
:
"paddings"
,
attrs
:
opDesc
.
attrs
)
dilations
=
try
ConvAddBatchNormReluParam
.
getAttr
(
key
:
"dilations"
,
attrs
:
opDesc
.
attrs
)
dilations
=
try
ConvAddBatchNormReluParam
.
getAttr
(
key
:
"dilations"
,
attrs
:
opDesc
.
attrs
)
...
@@ -99,4 +105,9 @@ class ConvAddBatchNormReluOp<P: PrecisionType>: Operator<ConvAddBatchNormReluKer
...
@@ -99,4 +105,9 @@ class ConvAddBatchNormReluOp<P: PrecisionType>: Operator<ConvAddBatchNormReluKer
static
func
fusionType
()
->
String
{
static
func
fusionType
()
->
String
{
return
gConvAddBatchNormReluType
return
gConvAddBatchNormReluType
}
}
func
delogOutput
()
{
}
}
}
metal/paddle-mobile/paddle-mobile/Operators/ConvAddOp.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// ConvAddBatchNormReluOp.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/8.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
@@ -14,7 +20,7 @@ class ConvAddParam<P: PrecisionType>: OpParam {
...
@@ -14,7 +20,7 @@ class ConvAddParam<P: PrecisionType>: OpParam {
do
{
do
{
filter
=
try
ConvAddParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
filter
=
try
ConvAddParam
.
inputFilter
(
paraInputs
:
opDesc
.
paraInputs
,
from
:
inScope
)
input
=
try
ConvAddParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
input
=
try
ConvAddParam
.
input
(
inputs
:
opDesc
.
inputs
,
from
:
inScope
)
output
=
try
ConvAddParam
.
output
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
output
=
try
ConvAddParam
.
output
Out
(
outputs
:
opDesc
.
outputs
,
from
:
inScope
)
stride
=
try
ConvAddParam
.
getAttr
(
key
:
"strides"
,
attrs
:
opDesc
.
attrs
)
stride
=
try
ConvAddParam
.
getAttr
(
key
:
"strides"
,
attrs
:
opDesc
.
attrs
)
paddings
=
try
ConvAddParam
.
getAttr
(
key
:
"paddings"
,
attrs
:
opDesc
.
attrs
)
paddings
=
try
ConvAddParam
.
getAttr
(
key
:
"paddings"
,
attrs
:
opDesc
.
attrs
)
dilations
=
try
ConvAddParam
.
getAttr
(
key
:
"dilations"
,
attrs
:
opDesc
.
attrs
)
dilations
=
try
ConvAddParam
.
getAttr
(
key
:
"dilations"
,
attrs
:
opDesc
.
attrs
)
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/BatchNormKernel.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// BatchNormKernel.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/5.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvAddBatchNormReluKernel.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// ConvKernel.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/5.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
@@ -64,4 +70,6 @@ class ConvAddBatchNormReluKernel<P: PrecisionType>: Kernel, Computable {
...
@@ -64,4 +70,6 @@ class ConvAddBatchNormReluKernel<P: PrecisionType>: Kernel, Computable {
encoder
.
dispatch
(
computePipline
:
pipline
,
outTexture
:
param
.
output
.
metalTexture
)
encoder
.
dispatch
(
computePipline
:
pipline
,
outTexture
:
param
.
output
.
metalTexture
)
encoder
.
endEncoding
()
encoder
.
endEncoding
()
}
}
}
}
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvAddKernel.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// ConvKernel.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/5.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvKernel.metal
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// ConvKernel.metal
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/7.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <metal_stdlib>
#include <metal_stdlib>
using namespace metal;
using namespace metal;
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvKernel.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// ConvKernel.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/5.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/ElementwiseAddKernel.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// ElementwiseAddKernel.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/5.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
...
metal/paddle-mobile/paddle-mobile/Operators/Kernels/Texture2DTo2DArrayKernel.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// Texture2DTo2DArrayKernel.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/6.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
...
metal/paddle-mobile/paddle-mobile/Operators/PoolOp.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// PoolOp.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/9.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
...
metal/paddle-mobile/paddle-mobile/Operators/ReshapeOp.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// PoolOp.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/9.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
...
metal/paddle-mobile/paddle-mobile/Operators/SoftmaxOp.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// PoolOp.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/9.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
...
metal/paddle-mobile/paddle-mobile/Program/OpDesc.swift
浏览文件 @
3df1380c
...
@@ -17,7 +17,7 @@ import Foundation
...
@@ -17,7 +17,7 @@ import Foundation
struct
OpDesc
{
struct
OpDesc
{
let
inputs
:
[
String
:
[
String
]]
let
inputs
:
[
String
:
[
String
]]
var
paraInputs
:
[
String
:
[
String
]]
var
paraInputs
:
[
String
:
[
String
]]
let
outputs
:
[
String
:
[
String
]]
var
outputs
:
[
String
:
[
String
]]
let
unusedOutputs
:
[
String
:
[
String
]]
let
unusedOutputs
:
[
String
:
[
String
]]
var
attrs
:
[
String
:
Attr
]
=
[:]
var
attrs
:
[
String
:
Attr
]
=
[:]
var
type
:
String
var
type
:
String
...
...
metal/paddle-mobile/paddle-mobile/Program/ProgramOptimize.swift
浏览文件 @
3df1380c
//
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
// ProgramOptimize.swift
// paddle-mobile
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
// Created by liuRuiLong on 2018/7/8.
You may obtain a copy of the License at
// Copyright © 2018年 orange. All rights reserved.
//
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
import
Foundation
import
Foundation
...
@@ -56,6 +62,7 @@ class Node {
...
@@ -56,6 +62,7 @@ class Node {
let
change
=
fusion
.
change
()
let
change
=
fusion
.
change
()
let
inOutputs
=
outputs
let
inOutputs
=
outputs
outputs
.
removeAll
()
outputs
.
removeAll
()
opDesc
?
.
outputs
.
removeAll
()
for
i
in
0
..<
inOutputs
.
count
{
for
i
in
0
..<
inOutputs
.
count
{
inOutputs
[
i
]
.
folderWith
(
beginNode
:
self
,
matchNode
:
fusionNode
.
outputs
[
i
],
change
:
change
,
removedNodes
:
&
removedNodes
)
inOutputs
[
i
]
.
folderWith
(
beginNode
:
self
,
matchNode
:
fusionNode
.
outputs
[
i
],
change
:
change
,
removedNodes
:
&
removedNodes
)
}
}
...
@@ -89,6 +96,8 @@ class Node {
...
@@ -89,6 +96,8 @@ class Node {
if
matchNode
.
outputs
.
count
==
0
{
if
matchNode
.
outputs
.
count
==
0
{
beginNode
.
outputs
.
append
(
contentsOf
:
outputs
)
beginNode
.
outputs
.
append
(
contentsOf
:
outputs
)
beginNode
.
opDesc
?
.
outputs
=
inOpdesc
.
outputs
}
}
removedNodes
.
append
(
self
)
removedNodes
.
append
(
self
)
...
@@ -158,7 +167,6 @@ class ProgramOptimize<P: PrecisionType> {
...
@@ -158,7 +167,6 @@ class ProgramOptimize<P: PrecisionType> {
_
=
inputNode
-->
node
_
=
inputNode
-->
node
}
}
}
}
}
}
}
}
...
@@ -193,7 +201,6 @@ class ProgramOptimize<P: PrecisionType> {
...
@@ -193,7 +201,6 @@ class ProgramOptimize<P: PrecisionType> {
nodes
.
remove
(
element
:
removeNode
)
nodes
.
remove
(
element
:
removeNode
)
}
}
}
}
}
}
}
}
}
}
...
...
metal/paddle-mobile/paddle-mobile/framework/Tensor.swift
浏览文件 @
3df1380c
...
@@ -148,18 +148,25 @@ class Tensor<P: PrecisionType>: Tensorial {
...
@@ -148,18 +148,25 @@ class Tensor<P: PrecisionType>: Tensorial {
extension
Tensor
{
extension
Tensor
{
var
debugDescription
:
String
{
var
debugDescription
:
String
{
var
str
=
""
var
str
=
""
str
+=
"Dim:
\(
dim
)
\n
value:[ "
if
data
.
size
<
20
{
// for i in 0..<buffer.length/MemoryLayout<P>.stride {
for
d
in
0
..<
data
.
size
{
// str += " \(buffer.contents().assumingMemoryBound(to: P.self)[i])"
str
+=
"
\(
data
[
d
]
)
"
// }
}
}
else
{
for
d
in
stride
(
from
:
0
,
to
:
data
.
size
,
by
:
data
.
size
/
20
)
{
str
+=
"
\(
data
[
d
]
)
"
}
}
str
+=
" ]"
return
str
return
str
// var str = ""
// str += "Dim: \(dim) \n value:[ "
// if data.size < 20 {
// for d in 0..<data.size {
// str += " \(data[d]) "
// }
// } else {
// for d in stride(from: 0, to: data.size, by: data.size/20) {
// str += " \(data[d]) "
// }
// }
// str += " ]"
// return str
}
}
var
description
:
String
{
var
description
:
String
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录