未验证 提交 dad903fe 编写于 作者: xiebaiyuan's avatar xiebaiyuan 提交者: GitHub

Merge pull request #1557 from loadingArbert/liuqingcan/adaptationXcode10_2

adapter new xcode & remove annotation
......@@ -352,6 +352,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_LANGUAGE_REVISION = iOSMetal10;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
......@@ -362,6 +363,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_LANGUAGE_REVISION = iOSMetal10;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
......
......@@ -17,9 +17,9 @@
4AA1EA942146661500D0F791 /* ShapeKernel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AA1EA932146661500D0F791 /* ShapeKernel.swift */; };
4AA1EA982146666500D0F791 /* FlattenOp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AA1EA972146666500D0F791 /* FlattenOp.swift */; };
4AA1EAA2214912CD00D0F791 /* FlattenKernel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AA1EAA1214912CC00D0F791 /* FlattenKernel.swift */; };
C28FE02F21BA68C00054EFAC /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C28FE02C21BA68C00054EFAC /* Metal.framework */; };
C28FE03021BA68C00054EFAC /* MetalPerformanceShaders.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C28FE02D21BA68C00054EFAC /* MetalPerformanceShaders.framework */; };
C28FE03121BA68C00054EFAC /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C28FE02E21BA68C00054EFAC /* MetalKit.framework */; };
C28FE02F21BA68C00054EFAC /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C28FE02C21BA68C00054EFAC /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
C28FE03021BA68C00054EFAC /* MetalPerformanceShaders.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C28FE02D21BA68C00054EFAC /* MetalPerformanceShaders.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
C28FE03121BA68C00054EFAC /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C28FE02E21BA68C00054EFAC /* MetalKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
D3831F70E7E0B565B9AC22DA /* Pods_paddle_mobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD2E06330A1E7129C918DB46 /* Pods_paddle_mobile.framework */; };
FC039B6F20E11C3C0081E9F8 /* paddle_mobile.h in Headers */ = {isa = PBXBuildFile; fileRef = FC039B6D20E11C3C0081E9F8 /* paddle_mobile.h */; settings = {ATTRIBUTES = (Public, ); }; };
FC039B9720E11C9A0081E9F8 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC039B9420E11C9A0081E9F8 /* Extensions.swift */; };
......
......@@ -22,8 +22,6 @@ public protocol SummableMultipliable: Equatable {
}
public protocol PrecisionProtocol: SummableMultipliable{
init(inFloat: Float32)
init(inFloat16: Float16)
init<P: PrecisionProtocol>(_ inP: P)
static var bitSize: UInt { get }
static func initializeValue() -> Self
......@@ -42,11 +40,12 @@ extension Float16: PrecisionProtocol {
}
public init<P>(_ inP: P) where P : PrecisionProtocol {
if P.bitSize == Float32.bitSize {
self = Float16(inFloat: inP as! Float32)
} else if P.bitSize == Float16.bitSize {
self = inP as! Float16
} else {
switch P.precisionType {
case .Float32:
fatalError()
case .Float16:
self = inP as! Int16
default:
fatalError()
}
}
......@@ -55,12 +54,6 @@ extension Float16: PrecisionProtocol {
return 16
}
public init(inFloat16: Float16) {
self = inFloat16
}
public init(inFloat: Float32) {
self = Int16(inFloat)
}
}
extension Float32: PrecisionProtocol {
......@@ -74,23 +67,16 @@ extension Float32: PrecisionProtocol {
}
public init<P>(_ inP: P) where P : PrecisionProtocol {
if P.bitSize == Float32.bitSize {
switch P.precisionType {
case .Float32:
self = inP as! Float32
} else if P.bitSize == Float16.bitSize {
self = Float32.init(inP as! Float16)
} else {
case .Float16:
self = Float32.init(Int32.init(inP as! Int16))
default:
fatalError()
}
}
public init(inFloat: Float32) {
self = inFloat
}
public init(inFloat16: Float16) {
self = Float32.init(inFloat16)
}
public static var bitSize: UInt {
return 32
}
......
......@@ -161,8 +161,9 @@ public class Loader<P: PrecisionProtocol>: Loaderable{
let programDesc = ProgramOptimize<P>.init().optimize(originProgramDesc: originProgramDesc)
// let programDesc = PMProgramDesc.init(protoProgram: protoProgram)
print(programDesc)
if GlobalConfig.shared.debug {
print(programDesc)
}
guard programDesc.blocks.count > 0 else {
throw PaddleMobileError.loaderError(message: "count of blocks must greater than 0")
......
......@@ -165,7 +165,9 @@ public class Texture: Tensorial {
// 初始化时 dim padToFourDim 模型中的维度(一般来说 nchw),前面补全0
init(device: MTLDevice, inDim: Dim) {
print(" in dim > \(inDim)")
if GlobalConfig.shared.debug {
print(" in dim > \(inDim)")
}
var fourDim: Dim
if inDim.cout() == 4 {
fourDim = inDim
......
......@@ -203,7 +203,9 @@ class ProgramOptimize<P: PrecisionProtocol> {
var typeMapNodes: [String : [(node: Node, output: [String : Node])]] = [:]
let block = originProgramDesc.blocks[0]
for opDesc in block.ops {
print(opDesc.type)
if GlobalConfig.shared.debug {
print(opDesc.type)
}
guard let opInputKeys = opInfos[opDesc.type]?.inputs, let outputKeys = opInfos[opDesc.type]?.outputs else {
fatalError()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册