Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit de575fe

Browse files
committed
Move T Tangent constraint.
1 parent d5e78cf commit de575fe

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Sources/TensorFlow/Core/Complex.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public struct Complex<T : FloatingPoint> {
2020
}
2121
}
2222

23-
extension Complex : Differentiable where T : Differentiable, T.TangentVector == T {
23+
extension Complex : Differentiable where T : Differentiable/*, T.TangentVector == T*/ {
2424
// ---------------------------------------------------------------------------
2525
// MARK: Differentiability
2626
// ---------------------------------------------------------------------------
@@ -135,7 +135,7 @@ extension Complex : AdditiveArithmetic {
135135
// ---------------------------------------------------------------------------
136136

137137
@inlinable
138-
@differentiable(vjp: _vjpAdd(lhs:rhs:) where T : Differentiable, T.TangentVector == T)
138+
@differentiable(vjp: _vjpAdd(lhs:rhs:) where T : Differentiable)
139139
public static func + (lhs: Complex, rhs: Complex) -> Complex {
140140
var lhs = lhs
141141
lhs += rhs
@@ -149,7 +149,7 @@ extension Complex : AdditiveArithmetic {
149149
}
150150

151151
@inlinable
152-
@differentiable(vjp: _vjpSubtract(lhs:rhs:) where T : Differentiable, T.TangentVector == T)
152+
@differentiable(vjp: _vjpSubtract(lhs:rhs:) where T : Differentiable)
153153
public static func - (lhs: Complex, rhs: Complex) -> Complex {
154154
var lhs = lhs
155155
lhs -= rhs
@@ -175,7 +175,7 @@ extension Complex : Numeric {
175175
}
176176

177177
@inlinable
178-
@differentiable(vjp: _vjpMultiply(lhs:rhs:) where T : Differentiable, T.TangentVector == T)
178+
@differentiable(vjp: _vjpMultiply(lhs:rhs:) where T : Differentiable)
179179
public static func * (lhs: Complex, rhs: Complex) -> Complex {
180180
var a = lhs.real, b = lhs.imaginary, c = rhs.real, d = rhs.imaginary
181181
let ac = a * c, bd = b * d, ad = a * d, bc = b * c
@@ -244,7 +244,7 @@ extension Complex : SignedNumeric {
244244
// ---------------------------------------------------------------------------
245245

246246
@inlinable
247-
@differentiable(vjp: _vjpNegate where T : Differentiable, T.TangentVector == T)
247+
@differentiable(vjp: _vjpNegate where T : Differentiable)
248248
public static prefix func - (operand: Complex) -> Complex {
249249
return Complex(real: -operand.real, imaginary: -operand.imaginary)
250250
}
@@ -262,7 +262,7 @@ extension Complex {
262262
// ---------------------------------------------------------------------------
263263

264264
@inlinable
265-
@differentiable(vjp: _vjpDivide(lhs:rhs:) where T : Differentiable, T.TangentVector == T)
265+
@differentiable(vjp: _vjpDivide(lhs:rhs:) where T : Differentiable)
266266
public static func / (lhs: Complex, rhs: Complex) -> Complex {
267267
var a = lhs.real, b = lhs.imaginary, c = rhs.real, d = rhs.imaginary
268268
var x: T
@@ -353,7 +353,7 @@ extension Complex {
353353
}
354354
}
355355

356-
extension Complex where T : Differentiable, T.TangentVector == T {
356+
extension Complex where T : Differentiable/*, T.TangentVector == T*/ {
357357
@inlinable
358358
static func _vjpAdd(lhs: Complex, rhs: Complex)
359359
-> (Complex, (Complex) -> (Complex, Complex)) {
@@ -383,7 +383,9 @@ extension Complex where T : Differentiable, T.TangentVector == T {
383383
-> (Complex, (Complex) -> Complex) {
384384
return (-operand, { v in -v})
385385
}
386+
}
386387

388+
extension Complex where T : Differentiable, T.TangentVector == T {
387389
@inlinable
388390
func _vjpAdding(real: T) -> (Complex, (Complex) -> (Complex, T)) {
389391
return (self.adding(real: real), { ($0, $0.real) })
@@ -403,4 +405,4 @@ extension Complex where T : Differentiable, T.TangentVector == T {
403405
func _vjpSubtracting(imaginary: T) -> (Complex, (Complex) -> (Complex, T)) {
404406
return (self.subtracting(real: real), { ($0, -$0.imaginary) })
405407
}
406-
}
408+
}

0 commit comments

Comments
 (0)