Skip to content

Commit

Permalink
Merge pull request #1 from tengyifei/master
Browse files Browse the repository at this point in the history
Update Swift Protobuf to 1.0.0
  • Loading branch information
RockfordWei authored Oct 15, 2017
2 parents c82e0c1 + 9ce3b8a commit f638c65
Show file tree
Hide file tree
Showing 63 changed files with 4,544 additions and 980 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ let package = Package(
Target(name: "PerfectTensorFlow", dependencies: ["TensorFlowAPI"])
],
dependencies: [
.Package(url: "https://github.com/apple/swift-protobuf.git", majorVersion:0)
.Package(url: "https://github.com/apple/swift-protobuf.git", majorVersion:1)
]
)
6 changes: 3 additions & 3 deletions Sources/PerfectTensorFlow/PerfectTensorFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public class TensorFlow {
public typealias QueueRunnerDef = Tensorflow_QueueRunnerDef
public typealias ReaderBaseState = Tensorflow_ReaderBaseState
public typealias RemoteFusedGraphExecuteInfo = Tensorflow_RemoteFusedGraphExecuteInfo
public typealias ResourceHandle = Tensorflow_ResourceHandle
public typealias ResourceHandle = Tensorflow_ResourceHandleProto
public typealias AutoParallelOptions = Tensorflow_AutoParallelOptions
public typealias RewriterConfig = Tensorflow_RewriterConfig
public typealias SavedModel = Tensorflow_SavedModel
Expand Down Expand Up @@ -249,10 +249,10 @@ public class TensorFlow {
public typealias Tfcompile_Config = Tensorflow_Tfcompile_Config
public typealias Tfprof_CodeDef = Tensorflow_Tfprof_CodeDef
public typealias Tfprof_OpLogEntry = Tensorflow_Tfprof_OpLogEntry
public typealias Tfprof_OpLog = Tensorflow_Tfprof_OpLog
public typealias Tfprof_OpLog = Tensorflow_Tfprof_OpLogProto
public typealias Tfprof_OptionsProto = Tensorflow_Tfprof_OptionsProto
public typealias Tfprof_TFProfTensorProto = Tensorflow_Tfprof_TFProfTensorProto
public typealias Tfprof_TFGraphNodeProto = Tensorflow_Tfprof_TFGraphNodeProto
//public typealias Tfprof_TFGraphNodeProto = Tensorflow_Tfprof_TFGraphNodeProto
//public typealias Tfprof_TFCodeNodeProto = Tensorflow_Tfprof_TFCodeNodeProto
public typealias Contrib_Tensorboard_TraceInfo = Tensorflow_Contrib_Tensorboard_TraceInfo
public typealias Contrib_Tensorboard_OpInfo = Tensorflow_Contrib_Tensorboard_OpInfo
Expand Down
5 changes: 3 additions & 2 deletions Sources/PerfectTensorFlow/pb.api_objects.swift
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,9 @@ extension ThirdParty_Tensorflow_Tools_Api_TFAPIObject: SwiftProtobuf._MessageImp

public func _protobuf_generated_isEqualTo(other: ThirdParty_Tensorflow_Tools_Api_TFAPIObject) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._path != other_storage._path {return false}
if _storage._tfModule != other_storage._tfModule {return false}
if _storage._tfClass != other_storage._tfClass {return false}
Expand Down
5 changes: 3 additions & 2 deletions Sources/PerfectTensorFlow/pb.attr_value.swift
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,9 @@ extension Tensorflow_AttrValue: SwiftProtobuf._MessageImplementationBase, SwiftP

public func _protobuf_generated_isEqualTo(other: Tensorflow_AttrValue) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._value != other_storage._value {return false}
return true
}
Expand Down
5 changes: 3 additions & 2 deletions Sources/PerfectTensorFlow/pb.compare_test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,9 @@ extension CompareTest_Large: SwiftProtobuf._MessageImplementationBase, SwiftProt

public func _protobuf_generated_isEqualTo(other: CompareTest_Large) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._string_ != other_storage._string_ {return false}
if _storage._int64_ != other_storage._int64_ {return false}
if _storage._float_ != other_storage._float_ {return false}
Expand Down
62 changes: 51 additions & 11 deletions Sources/PerfectTensorFlow/pb.config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ public struct Tensorflow_GraphOptions: SwiftProtobuf.Message {
}

/// Options that control the type and amount of graph rewriting.
/// Not currently configurable via the public Python API (i.e. there is no API
/// stability guarantee if you import RewriterConfig explicitly).
public var rewriteOptions: Tensorflow_RewriterConfig {
get {return _storage._rewriteOptions ?? Tensorflow_RewriterConfig()}
set {_uniqueStorage()._rewriteOptions = newValue}
Expand Down Expand Up @@ -437,6 +439,23 @@ public struct Tensorflow_ThreadPoolOptionProto: SwiftProtobuf.Message {
/// (see the declaration of the specific field for more info).
public var numThreads: Int32 = 0

/// The global name of the threadpool.
///
/// If empty, then the threadpool is made and used according to the scope it's
/// in - e.g., for a session threadpool, it is used by that session only.
///
/// If non-empty, then:
/// - a global threadpool associated with this name is looked
/// up or created. This allows, for example, sharing one threadpool across
/// many sessions (e.g., like the default behavior, if
/// inter_op_parallelism_threads is not configured), but still partitioning
/// into a large and small pool.
/// - if the threadpool for this global_name already exists, then it is an
/// error if the existing pool was created using a different num_threads
/// value as is specified on this call.
/// - threadpools created this way are never garbage collected.
public var globalName: String = String()

public var unknownFields = SwiftProtobuf.UnknownStorage()

public init() {}
Expand All @@ -449,6 +468,7 @@ public struct Tensorflow_ThreadPoolOptionProto: SwiftProtobuf.Message {
while let fieldNumber = try decoder.nextFieldNumber() {
switch fieldNumber {
case 1: try decoder.decodeSingularInt32Field(value: &self.numThreads)
case 2: try decoder.decodeSingularStringField(value: &self.globalName)
default: break
}
}
Expand All @@ -462,6 +482,9 @@ public struct Tensorflow_ThreadPoolOptionProto: SwiftProtobuf.Message {
if self.numThreads != 0 {
try visitor.visitSingularInt32Field(value: self.numThreads, fieldNumber: 1)
}
if !self.globalName.isEmpty {
try visitor.visitSingularStringField(value: self.globalName, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}
}
Expand Down Expand Up @@ -555,13 +578,24 @@ public struct Tensorflow_ConfigProto: SwiftProtobuf.Message {
}

/// This option is experimental - it may be replaced with a different mechanism
/// in the future. The intended use is for when some session invocations need
/// to run in a background pool limited to a small number of threads.
/// in the future.
///
/// Configures session thread pools. If this is configured, then RunOptions for
/// a Run call can select the thread pool to use.
///
/// If a pool's num_threads is 0, then inter_op_parallelism_threads is used.
/// The intended use is for when some session invocations need to run in a
/// background pool limited to a small number of threads:
/// - For example, a session may be configured to have one large pool (for
/// regular compute) and one small pool (for periodic, low priority work);
/// using the small pool is currently the mechanism for limiting the inter-op
/// parallelism of the low priority work. Note that it does not limit the
/// parallelism of work spawned by a single op kernel implementation.
/// - Using this setting is normally not needed in training, but may help some
/// serving use cases.
/// - It is also generally recommended to set the global_name field of this
/// proto, to avoid creating multiple large pools. It is typically better to
/// run the non-low-priority work, even across sessions, in a single large
/// pool.
public var sessionInterOpThreadPool: [Tensorflow_ThreadPoolOptionProto] {
get {return _storage._sessionInterOpThreadPool}
set {_uniqueStorage()._sessionInterOpThreadPool = newValue}
Expand Down Expand Up @@ -1055,8 +1089,9 @@ extension Tensorflow_GraphOptions: SwiftProtobuf._MessageImplementationBase, Swi

public func _protobuf_generated_isEqualTo(other: Tensorflow_GraphOptions) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._enableRecvScheduling != other_storage._enableRecvScheduling {return false}
if _storage._optimizerOptions != other_storage._optimizerOptions {return false}
if _storage._buildCostModel != other_storage._buildCostModel {return false}
Expand All @@ -1078,10 +1113,12 @@ extension Tensorflow_GraphOptions: SwiftProtobuf._MessageImplementationBase, Swi
extension Tensorflow_ThreadPoolOptionProto: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "num_threads"),
2: .standard(proto: "global_name"),
]

public func _protobuf_generated_isEqualTo(other: Tensorflow_ThreadPoolOptionProto) -> Bool {
if self.numThreads != other.numThreads {return false}
if self.globalName != other.globalName {return false}
if unknownFields != other.unknownFields {return false}
return true
}
Expand Down Expand Up @@ -1164,8 +1201,9 @@ extension Tensorflow_ConfigProto: SwiftProtobuf._MessageImplementationBase, Swif

public func _protobuf_generated_isEqualTo(other: Tensorflow_ConfigProto) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._deviceCount != other_storage._deviceCount {return false}
if _storage._intraOpParallelismThreads != other_storage._intraOpParallelismThreads {return false}
if _storage._interOpParallelismThreads != other_storage._interOpParallelismThreads {return false}
Expand Down Expand Up @@ -1227,8 +1265,9 @@ extension Tensorflow_RunOptions: SwiftProtobuf._MessageImplementationBase, Swift

public func _protobuf_generated_isEqualTo(other: Tensorflow_RunOptions) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._traceLevel != other_storage._traceLevel {return false}
if _storage._timeoutInMs != other_storage._timeoutInMs {return false}
if _storage._interOpThreadPool != other_storage._interOpThreadPool {return false}
Expand Down Expand Up @@ -1284,8 +1323,9 @@ extension Tensorflow_RunMetadata: SwiftProtobuf._MessageImplementationBase, Swif

public func _protobuf_generated_isEqualTo(other: Tensorflow_RunMetadata) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._stepStats != other_storage._stepStats {return false}
if _storage._costGraph != other_storage._costGraph {return false}
if _storage._partitionGraphs != other_storage._partitionGraphs {return false}
Expand Down
10 changes: 6 additions & 4 deletions Sources/PerfectTensorFlow/pb.control_flow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,9 @@ extension Tensorflow_CondContextDef: SwiftProtobuf._MessageImplementationBase, S

public func _protobuf_generated_isEqualTo(other: Tensorflow_CondContextDef) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._contextName != other_storage._contextName {return false}
if _storage._predName != other_storage._predName {return false}
if _storage._pivotName != other_storage._pivotName {return false}
Expand Down Expand Up @@ -417,8 +418,9 @@ extension Tensorflow_WhileContextDef: SwiftProtobuf._MessageImplementationBase,

public func _protobuf_generated_isEqualTo(other: Tensorflow_WhileContextDef) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._contextName != other_storage._contextName {return false}
if _storage._parallelIterations != other_storage._parallelIterations {return false}
if _storage._backProp != other_storage._backProp {return false}
Expand Down
5 changes: 3 additions & 2 deletions Sources/PerfectTensorFlow/pb.cost_graph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ extension Tensorflow_CostGraphDef.Node.OutputInfo: SwiftProtobuf._MessageImpleme

public func _protobuf_generated_isEqualTo(other: Tensorflow_CostGraphDef.Node.OutputInfo) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._size != other_storage._size {return false}
if _storage._aliasInputPort != other_storage._aliasInputPort {return false}
if _storage._shape != other_storage._shape {return false}
Expand Down
10 changes: 6 additions & 4 deletions Sources/PerfectTensorFlow/pb.cpp_shape_inference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ extension Tensorflow_CppShapeInferenceResult: SwiftProtobuf._MessageImplementati

public func _protobuf_generated_isEqualTo(other: Tensorflow_CppShapeInferenceResult) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._shape != other_storage._shape {return false}
if _storage._handleData != other_storage._handleData {return false}
return true
Expand Down Expand Up @@ -293,8 +294,9 @@ extension Tensorflow_CppShapeInferenceResult.HandleShapeAndType: SwiftProtobuf._

public func _protobuf_generated_isEqualTo(other: Tensorflow_CppShapeInferenceResult.HandleShapeAndType) -> Bool {
if _storage !== other._storage {
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) -> Bool in
let _storage = _args.0; let other_storage = _args.1
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in
let _storage = _args.0
let other_storage = _args.1
if _storage._shape != other_storage._shape {return false}
if _storage._dtype != other_storage._dtype {return false}
return true
Expand Down
Loading

0 comments on commit f638c65

Please sign in to comment.