diff --git a/Package.swift b/Package.swift index e489eccd4..e832894f4 100644 --- a/Package.swift +++ b/Package.swift @@ -50,6 +50,10 @@ let package = Package( "PythonKit", "CTensorFlow", .product(name: "Numerics", package: "swift-numerics"), + ], + swiftSettings: [ + .define("USING_X10_BACKEND"), + .define("DEFAULT_BACKEND_EAGER"), ]), .target( name: "Experimental", diff --git a/Sources/TensorFlow/Core/Device.swift b/Sources/TensorFlow/Core/Device.swift deleted file mode 100644 index cb985823a..000000000 --- a/Sources/TensorFlow/Core/Device.swift +++ /dev/null @@ -1,35 +0,0 @@ -/// A device on which `Tensor`s can be allocated. -/// -/// Currently, this is a stub because TensorFlow transfers tensors between devices on demand. -public struct Device { - public static var `default`: Device { Device() } - public static var defaultTFEager: Device { Device() } - - /// Backend used to dispatch the tensor operations. - public enum Backend { - case TF_EAGER - - fileprivate var shortName: String { - switch self { - case .TF_EAGER: return "TF_EAGER" - } - } - } -} - -extension Tensor { - /// The device on which `self` is allocated. - public var device: Device { - @_semantics("autodiff.nonvarying") - get { - return Device() - } - } -} - -extension _Raw { - static func toDevice(_ x: Tensor, _ device: Device) -> Tensor { - // TODO: Actually copy to device... - return x - } -} diff --git a/Sources/TensorFlow/X10/APIs/CrossReplicaSum.swift b/Sources/TensorFlow/X10/APIs/CrossReplicaSum.swift new file mode 120000 index 000000000..75326de1b --- /dev/null +++ b/Sources/TensorFlow/X10/APIs/CrossReplicaSum.swift @@ -0,0 +1 @@ +../../../x10/swift_bindings/apis/CrossReplicaSum.swift \ No newline at end of file diff --git a/Sources/TensorFlow/X10/APIs/DeviceScope.swift b/Sources/TensorFlow/X10/APIs/DeviceScope.swift new file mode 120000 index 000000000..b0f9117b6 --- /dev/null +++ b/Sources/TensorFlow/X10/APIs/DeviceScope.swift @@ -0,0 +1 @@ +../../../x10/swift_bindings/apis/DeviceScope.swift \ No newline at end of file diff --git a/Sources/TensorFlow/X10/APIs/RawOpsManual.swift b/Sources/TensorFlow/X10/APIs/RawOpsManual.swift new file mode 120000 index 000000000..591bb2ae4 --- /dev/null +++ b/Sources/TensorFlow/X10/APIs/RawOpsManual.swift @@ -0,0 +1 @@ +../../../x10/swift_bindings/apis/RawOpsManual.swift \ No newline at end of file diff --git a/Sources/TensorFlow/X10/Device.swift b/Sources/TensorFlow/X10/Device.swift new file mode 120000 index 000000000..46dc06205 --- /dev/null +++ b/Sources/TensorFlow/X10/Device.swift @@ -0,0 +1 @@ +../../x10/swift_bindings/Device.swift \ No newline at end of file diff --git a/Sources/TensorFlow/X10/RawOpsXLAGenerated.swift b/Sources/TensorFlow/X10/RawOpsXLAGenerated.swift new file mode 120000 index 000000000..092ebabda --- /dev/null +++ b/Sources/TensorFlow/X10/RawOpsXLAGenerated.swift @@ -0,0 +1 @@ +../../x10/swift_bindings/RawOpsXLAGenerated.swift \ No newline at end of file diff --git a/Sources/TensorFlow/X10/XLAScalarType.swift b/Sources/TensorFlow/X10/XLAScalarType.swift new file mode 120000 index 000000000..9e13e7567 --- /dev/null +++ b/Sources/TensorFlow/X10/XLAScalarType.swift @@ -0,0 +1 @@ +../../x10/swift_bindings/XLAScalarType.swift \ No newline at end of file diff --git a/Sources/TensorFlow/X10/XLATensor.swift b/Sources/TensorFlow/X10/XLATensor.swift new file mode 120000 index 000000000..a356e0ff8 --- /dev/null +++ b/Sources/TensorFlow/X10/XLATensor.swift @@ -0,0 +1 @@ +../../x10/swift_bindings/XLATensor.swift \ No newline at end of file