Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
e2f36b92
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看板
未验证
提交
e2f36b92
编写于
9月 07, 2018
作者:
R
Ruilong Liu
提交者:
GitHub
9月 07, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #922 from codeWorm2015/metal
add new interface
上级
eaaa656f
cda2cd84
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
111 addition
and
0 deletion
+111
-0
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
+12
-0
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.h
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.h
+90
-0
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m
+9
-0
未找到文件。
metal/paddle-mobile/paddle-mobile.xcodeproj/project.pbxproj
浏览文件 @
e2f36b92
...
...
@@ -41,6 +41,8 @@
FC0E2DBE20EE460D009C1FAC
/* BatchNormKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC0E2DBD20EE460D009C1FAC
/* BatchNormKernel.swift */
;
};
FC0E2DC020EE461F009C1FAC
/* ElementwiseAddKernel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC0E2DBF20EE461F009C1FAC
/* ElementwiseAddKernel.swift */
;
};
FC1B16B320EC9A4F00678B91
/* Kernels.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC1B16B220EC9A4F00678B91
/* Kernels.metal */
;
};
FC292C5421421B2F00CF622F
/* PaddleMobileGPU.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC292C5321421B2E00CF622F
/* PaddleMobileGPU.h */
;
};
FC292C5621421B4600CF622F
/* PaddleMobileGPU.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC292C5521421B4600CF622F
/* PaddleMobileGPU.m */
;
};
FC3602CC2108819F00FACB58
/* PaddleMobileUnitTest.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC3602CB2108819F00FACB58
/* PaddleMobileUnitTest.swift */
;
};
FC4CB74920F0B954007C0C6D
/* ConvKernel.metal in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC4CB74820F0B954007C0C6D
/* ConvKernel.metal */
;
};
FC4CB74B20F12C30007C0C6D
/* ProgramOptimize.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
FC4CB74A20F12C30007C0C6D
/* ProgramOptimize.swift */
;
};
...
...
@@ -137,6 +139,8 @@
FC0E2DBF20EE461F009C1FAC
/* ElementwiseAddKernel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ElementwiseAddKernel.swift
;
sourceTree
=
"<group>"
;
};
FC1B16B220EC9A4F00678B91
/* Kernels.metal */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.metal
;
path
=
Kernels.metal
;
sourceTree
=
"<group>"
;
};
FC27990D21341016000B6BAD
/* BoxCoder.metal */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.metal
;
path
=
BoxCoder.metal
;
sourceTree
=
"<group>"
;
};
FC292C5321421B2E00CF622F
/* PaddleMobileGPU.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
PaddleMobileGPU.h
;
sourceTree
=
"<group>"
;
};
FC292C5521421B4600CF622F
/* PaddleMobileGPU.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
PaddleMobileGPU.m
;
sourceTree
=
"<group>"
;
};
FC3602CB2108819F00FACB58
/* PaddleMobileUnitTest.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PaddleMobileUnitTest.swift
;
sourceTree
=
"<group>"
;
};
FC4CB74820F0B954007C0C6D
/* ConvKernel.metal */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.metal
;
path
=
ConvKernel.metal
;
sourceTree
=
"<group>"
;
};
FC4CB74A20F12C30007C0C6D
/* ProgramOptimize.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ProgramOptimize.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -246,6 +250,8 @@
FC039B6C20E11C3C0081E9F8
/* paddle-mobile */
=
{
isa
=
PBXGroup
;
children
=
(
FC292C5521421B4600CF622F
/* PaddleMobileGPU.m */
,
FC292C5321421B2E00CF622F
/* PaddleMobileGPU.h */
,
FC4FD9762140E4920073E130
/* CPU */
,
FC4FD9742140E1DE0073E130
/* PaddleMobile.swift */
,
FC039BAE20E11CC20081E9F8
/* Program */
,
...
...
@@ -418,6 +424,7 @@
buildActionMask
=
2147483647
;
files
=
(
FC4FD9792140E4980073E130
/* PaddleMobile.h in Headers */
,
FC292C5421421B2F00CF622F
/* PaddleMobileGPU.h in Headers */
,
FC039B6F20E11C3C0081E9F8
/* paddle_mobile.h in Headers */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -455,6 +462,7 @@
TargetAttributes
=
{
FC039B6920E11C3C0081E9F8
=
{
CreatedOnToolsVersion
=
9.3.1
;
LastSwiftMigration
=
0940
;
};
};
};
...
...
@@ -557,6 +565,7 @@
FC039BBF20E11CC20081E9F8
/* Attribute.swift in Sources */
,
FCD04E7420F3437E0007374F
/* ConvAddKernel.swift in Sources */
,
FC039BB920E11CC20081E9F8
/* Scope.swift in Sources */
,
FC292C5621421B4600CF622F
/* PaddleMobileGPU.m in Sources */
,
FCD04E6620F314C50007374F
/* PoolOp.swift in Sources */
,
FC039BAC20E11CBC0081E9F8
/* BatchNormOp.swift in Sources */
,
FCBCCC6F2123097100D94F7E
/* MulticlassNMSOp.swift in Sources */
,
...
...
@@ -724,6 +733,7 @@
isa
=
XCBuildConfiguration
;
baseConfigurationReference
=
CDF58151D902A1CBAE56A0C2
/* Pods-paddle-mobile.debug.xcconfig */
;
buildSettings
=
{
CLANG_ENABLE_MODULES
=
YES
;
CODE_SIGN_IDENTITY
=
""
;
CODE_SIGN_STYLE
=
Automatic
;
DEFINES_MODULE
=
YES
;
...
...
@@ -749,6 +759,7 @@
PRODUCT_BUNDLE_IDENTIFIER
=
"orange.paddle-mobile"
;
PRODUCT_NAME
=
"$(TARGET_NAME:c99extidentifier)"
;
SKIP_INSTALL
=
YES
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
SWIFT_VERSION
=
4.0
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
};
...
...
@@ -758,6 +769,7 @@
isa
=
XCBuildConfiguration
;
baseConfigurationReference
=
E2A7957C92EDA5C3BEC0FFC2
/* Pods-paddle-mobile.release.xcconfig */
;
buildSettings
=
{
CLANG_ENABLE_MODULES
=
YES
;
CODE_SIGN_IDENTITY
=
""
;
CODE_SIGN_STYLE
=
Automatic
;
DEFINES_MODULE
=
YES
;
...
...
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.h
0 → 100644
浏览文件 @
e2f36b92
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
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 <Metal/Metal.h>
#import <Foundation/Foundation.h>
typedef
enum
:
NSUInteger
{
MobileNet
,
MobileNetSSD
,
Genet
,
}
Net
;
@interface
ModelConfig
:
NSObject
/*
* 预处理需要用到的值 (三个)
*/
@property
(
strong
,
nonatomic
)
NSArray
<
NSNumber
*>
*
means
;
/*
* 预处理需要用到的 scale 值
*/
@property
(
assign
,
nonatomic
)
float
scale
;
/*
* 输出维度信息 [n c h w]
*/
@property
(
strong
,
nonatomic
)
NSArray
<
NSNumber
*>
*
dims
;
/*
* 模型参数内存地址
*/
@property
(
assign
,
nonatomic
)
void
*
paramPointer
;
/*
* 模型参数占用内存大小 (kb)
*/
@property
(
assign
,
nonatomic
)
int
paramSize
;
/*
* 模型内存地址
*/
@property
(
assign
,
nonatomic
)
void
*
modelPointer
;
/*
* 模型占用内存大小 (kb)
*/
@property
(
assign
,
nonatomic
)
int
modelSize
;
@end
@interface
PaddleMobileGPU
:
NSObject
/*
* 初始化
*/
-
(
instancetype
)
initWithCommandQueue
:(
id
<
MTLCommandQueue
>
)
queue
net
:(
Net
)
netType
modelConfig
:(
ModelConfig
*
)
config
;
/*
* paramPointer 模型参数内存地址
* paramSize 模型参数占用内存大小 (kb)
* modelPointer 模型内存地址
* modelSize 模型占用内存大小 (kb)
*/
-
(
BOOL
)
load
;
/*
* texture: 需要进行预测的图像转换的 texture
* completion: 预测完成回调
*/
-
(
void
)
predict
:(
id
<
MTLTexture
>
)
texture
withCompletion
:(
void
(
^
)(
BOOL
,
NSArray
<
NSNumber
*>
*
))
completion
;
/*
* 清理内存
*/
-
(
void
)
clrear
;
@end
metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m
0 → 100644
浏览文件 @
e2f36b92
//
// PaddleMobileGPU.m
// paddle-mobile
//
// Created by liuRuiLong on 2018/9/7.
// Copyright © 2018年 orange. All rights reserved.
//
#import
<Foundation
/
Foundation.h
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录