Skip to content

Commit a1d9369

Browse files
bgogulrxwei
authored andcommitted
Remove references to VectorProtocol from AD tests. (#27734)
1 parent d93efc1 commit a1d9369

14 files changed

+23
-23
lines changed

test/AutoDiff/derived_differentiable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct TestNoDerivative : EuclideanDifferentiable {
4444
// CHECK-AST: var w: Float
4545
// CHECK-AST: @noDerivative internal var technicallyDifferentiable: Float
4646
// CHECK-AST: internal init(w: Float, technicallyDifferentiable: Float)
47-
// CHECK-AST: internal struct TangentVector : _Differentiable, AdditiveArithmetic, ElementaryFunctions, VectorProtocol
47+
// CHECK-AST: internal struct TangentVector : _Differentiable, AdditiveArithmetic, ElementaryFunctions
4848
// CHECK-AST: internal typealias TangentVector = TestNoDerivative.TangentVector
4949
// CHECK-AST: internal var differentiableVectorView: TestNoDerivative.TangentVector { get }
5050

test/AutoDiff/differentiable_attr_type_checking.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ extension JVPStruct {
271271
}
272272
}
273273

274-
extension JVPStruct : VectorProtocol {
274+
extension JVPStruct : AdditiveArithmetic {
275275
static var zero: JVPStruct { fatalError("unimplemented") }
276276
static func + (lhs: JVPStruct, rhs: JVPStruct) -> JVPStruct {
277277
fatalError("unimplemented")
@@ -419,7 +419,7 @@ extension VJPStruct {
419419
}
420420
}
421421

422-
extension VJPStruct : VectorProtocol {
422+
extension VJPStruct : AdditiveArithmetic {
423423
static var zero: VJPStruct { fatalError("unimplemented") }
424424
static func + (lhs: VJPStruct, rhs: VJPStruct) -> VJPStruct {
425425
fatalError("unimplemented")

test/AutoDiff/differentiating_attr_type_checking.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,15 @@ func bar<T>(_ x: T) -> T {
256256
return x
257257
}
258258
@differentiating(bar)
259-
func vjpBar<T : Differentiable & VectorProtocol>(_ x: T) -> (value: T, pullback: (T.TangentVector) -> T.TangentVector) {
259+
func vjpBar<T : Differentiable>(_ x: T) -> (value: T, pullback: (T.TangentVector) -> T.TangentVector) {
260260
return (x, { $0 })
261261
}
262262

263263
func baz<T, U>(_ x: T, _ y: U) -> T {
264264
return x
265265
}
266266
@differentiating(baz)
267-
func vjpBaz<T : Differentiable & VectorProtocol, U : Differentiable>(_ x: T, _ y: U)
267+
func vjpBaz<T : Differentiable, U : Differentiable>(_ x: T, _ y: U)
268268
-> (value: T, pullback: (T) -> (T, U))
269269
where T == T.TangentVector, U == U.TangentVector
270270
{

test/AutoDiff/differentiation_transform_diagnostics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ _ = gradient(at: 0, in: one_to_one_0) // okay!
1919
struct S {
2020
var p: Float
2121
}
22-
extension S : Differentiable, VectorProtocol {
22+
extension S : Differentiable, AdditiveArithmetic {
2323
// Test custom `TangentVector` type with non-matching stored property name.
24-
struct TangentVector: Differentiable, VectorProtocol {
24+
struct TangentVector: Differentiable, AdditiveArithmetic {
2525
var dp: Float
2626
}
2727
typealias AllDifferentiableVariables = S

test/AutoDiff/e2e_differentiable_property.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import StdlibUnittest
88

99
var E2EDifferentiablePropertyTests = TestSuite("E2EDifferentiableProperty")
1010

11-
struct TangentSpace : VectorProtocol {
11+
struct TangentSpace : AdditiveArithmetic {
1212
let x, y: Float
1313
}
1414

@@ -81,7 +81,7 @@ E2EDifferentiablePropertyTests.test("generic stored property") {
8181
expectEqual(expectedGrad, actualGrad)
8282
}
8383

84-
struct ProductSpaceSelfTangent : VectorProtocol {
84+
struct ProductSpaceSelfTangent : AdditiveArithmetic {
8585
let x, y: Float
8686
}
8787

@@ -97,7 +97,7 @@ E2EDifferentiablePropertyTests.test("fieldwise product space, self tangent") {
9797
expectEqual(expectedGrad, actualGrad)
9898
}
9999

100-
struct ProductSpaceOtherTangentTangentSpace : VectorProtocol {
100+
struct ProductSpaceOtherTangentTangentSpace : AdditiveArithmetic {
101101
let x, y: Float
102102
}
103103

test/AutoDiff/forward_mode_runtime.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ ForwardModeTests.test("TupleNonDifferentiableElements") {
356356
//===----------------------------------------------------------------------===//
357357

358358
struct Tensor<Scalar : FloatingPoint & Differentiable>
359-
: VectorProtocol, Differentiable {
359+
: AdditiveArithmetic, Differentiable {
360360
// NOTE: `value` must have type with known size (e.g. `Float`, not `Scalar`)
361361
// until differentiation has indirect passing support.
362362
var value: Float
@@ -799,7 +799,7 @@ protocol Prot : Differentiable {
799799
func foo(x: Float) -> Float
800800
}
801801
ForwardModeTests.test("Simple Protocol") {
802-
struct Linear: Prot, VectorProtocol {
802+
struct Linear: Prot, AdditiveArithmetic {
803803
typealias TangentVector = Linear
804804

805805
let m: Float
@@ -832,7 +832,7 @@ extension DiffReq where TangentVector : AdditiveArithmetic {
832832
}
833833
}
834834

835-
struct Quadratic : DiffReq, VectorProtocol {
835+
struct Quadratic : DiffReq, AdditiveArithmetic {
836836
typealias TangentVector = Quadratic
837837

838838
@differentiable

test/AutoDiff/generics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ _ = gradient(at: Float(1), in: { x in identity(x) })
1616
// CHECK-SIL-NEXT: [[EMIT_ZERO_INDIRECT:%.*]] = apply [[ZERO_WITNESS]]<τ_0_0.TangentVector>([[ORIG_COTAN]], [[ORIG_COTAN_METATYPE]])
1717
// CHECK-SIL: }
1818

19-
struct Tensor<Scalar : FloatingPoint & Differentiable> : VectorProtocol, Differentiable {
19+
struct Tensor<Scalar : FloatingPoint & Differentiable> : Differentiable {
2020
// NOTE: `value` must have type with known size (e.g. `Float`, not `Scalar`)
2121
// until differentiation has indirect passing support.
2222
var value: Float

test/AutoDiff/method.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension Parameter {
4545
}
4646
}
4747

48-
extension Parameter : Differentiable, VectorProtocol {
48+
extension Parameter : Differentiable, AdditiveArithmetic {
4949
typealias TangentVector = Parameter
5050
typealias Scalar = Float
5151
typealias Shape = ()
@@ -177,7 +177,7 @@ struct CustomParameter : Equatable {
177177
}
178178
}
179179

180-
extension CustomParameter : Differentiable, VectorProtocol {
180+
extension CustomParameter : Differentiable, AdditiveArithmetic {
181181
typealias TangentVector = CustomParameter
182182
typealias Scalar = Float
183183
typealias Shape = ()

test/AutoDiff/protocol_requirement_autodiff.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension DiffReq where TangentVector : AdditiveArithmetic {
1818
}
1919
}
2020

21-
struct Quadratic : DiffReq, VectorProtocol {
21+
struct Quadratic : DiffReq, AdditiveArithmetic {
2222
typealias TangentVector = Quadratic
2323

2424
@differentiable

test/AutoDiff/refcounting.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class NonTrivialStuff : Equatable {
77
}
88

99
@frozen
10-
public struct Vector : AdditiveArithmetic, VectorProtocol, Differentiable, Equatable {
10+
public struct Vector : AdditiveArithmetic, Differentiable, Equatable {
1111
public var x: Float
1212
public var y: Float
1313
public var nonTrivialStuff = NonTrivialStuff()

test/AutoDiff/separate_tangent_type.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct DifferentiableSubset : Differentiable {
1717
var b: Float
1818
@noDerivative var flag: Bool
1919

20-
struct TangentVector : Differentiable, VectorProtocol {
20+
struct TangentVector : Differentiable, AdditiveArithmetic {
2121
typealias TangentVector = DifferentiableSubset.TangentVector
2222
var w: Float
2323
var b: Float

test/AutoDiff/simple_model.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct DenseLayer : Equatable {
1313
let b: Float
1414
}
1515

16-
extension DenseLayer : Differentiable, VectorProtocol {
16+
extension DenseLayer : Differentiable, AdditiveArithmetic {
1717
typealias TangentVector = DenseLayer
1818
typealias Scalar = Float
1919
static var zero: DenseLayer {
@@ -50,7 +50,7 @@ struct Model : Equatable {
5050
let l3: DenseLayer
5151
}
5252

53-
extension Model : Differentiable, VectorProtocol {
53+
extension Model : Differentiable, AdditiveArithmetic {
5454
typealias TangentVector = Model
5555
typealias Scalar = Float
5656
static var zero: Model {

test/AutoDiff/simple_real_vector.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
22

33
@frozen
4-
public struct Vector : AdditiveArithmetic, VectorProtocol, Differentiable {
4+
public struct Vector : AdditiveArithmetic, Differentiable {
55
public var x: Float
66
public var y: Float
77

test/AutoDiff/witness_table_sil.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ protocol Proto : Differentiable {
1111
func function3(_ x: Float, _ y: Double) -> Double
1212
}
1313

14-
struct S : Proto, VectorProtocol {
14+
struct S : Proto, AdditiveArithmetic {
1515
typealias Scalar = Float
1616

1717
@differentiable

0 commit comments

Comments
 (0)