Skip to content

Remove references to VectorProtocol from AD tests. #27734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/AutoDiff/derived_differentiable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct TestNoDerivative : EuclideanDifferentiable {
// CHECK-AST: var w: Float
// CHECK-AST: @noDerivative internal var technicallyDifferentiable: Float
// CHECK-AST: internal init(w: Float, technicallyDifferentiable: Float)
// CHECK-AST: internal struct TangentVector : _Differentiable, AdditiveArithmetic, ElementaryFunctions, VectorProtocol
// CHECK-AST: internal struct TangentVector : _Differentiable, AdditiveArithmetic, ElementaryFunctions
// CHECK-AST: internal typealias TangentVector = TestNoDerivative.TangentVector
// CHECK-AST: internal var differentiableVectorView: TestNoDerivative.TangentVector { get }

Expand Down
4 changes: 2 additions & 2 deletions test/AutoDiff/differentiable_attr_type_checking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ extension JVPStruct {
}
}

extension JVPStruct : VectorProtocol {
extension JVPStruct : AdditiveArithmetic {
static var zero: JVPStruct { fatalError("unimplemented") }
static func + (lhs: JVPStruct, rhs: JVPStruct) -> JVPStruct {
fatalError("unimplemented")
Expand Down Expand Up @@ -419,7 +419,7 @@ extension VJPStruct {
}
}

extension VJPStruct : VectorProtocol {
extension VJPStruct : AdditiveArithmetic {
static var zero: VJPStruct { fatalError("unimplemented") }
static func + (lhs: VJPStruct, rhs: VJPStruct) -> VJPStruct {
fatalError("unimplemented")
Expand Down
4 changes: 2 additions & 2 deletions test/AutoDiff/differentiating_attr_type_checking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,15 @@ func bar<T>(_ x: T) -> T {
return x
}
@differentiating(bar)
func vjpBar<T : Differentiable & VectorProtocol>(_ x: T) -> (value: T, pullback: (T.TangentVector) -> T.TangentVector) {
func vjpBar<T : Differentiable>(_ x: T) -> (value: T, pullback: (T.TangentVector) -> T.TangentVector) {
return (x, { $0 })
}

func baz<T, U>(_ x: T, _ y: U) -> T {
return x
}
@differentiating(baz)
func vjpBaz<T : Differentiable & VectorProtocol, U : Differentiable>(_ x: T, _ y: U)
func vjpBaz<T : Differentiable, U : Differentiable>(_ x: T, _ y: U)
-> (value: T, pullback: (T) -> (T, U))
where T == T.TangentVector, U == U.TangentVector
{
Expand Down
4 changes: 2 additions & 2 deletions test/AutoDiff/differentiation_transform_diagnostics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ _ = gradient(at: 0, in: one_to_one_0) // okay!
struct S {
var p: Float
}
extension S : Differentiable, VectorProtocol {
extension S : Differentiable, AdditiveArithmetic {
// Test custom `TangentVector` type with non-matching stored property name.
struct TangentVector: Differentiable, VectorProtocol {
struct TangentVector: Differentiable, AdditiveArithmetic {
var dp: Float
}
typealias AllDifferentiableVariables = S
Expand Down
6 changes: 3 additions & 3 deletions test/AutoDiff/e2e_differentiable_property.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import StdlibUnittest

var E2EDifferentiablePropertyTests = TestSuite("E2EDifferentiableProperty")

struct TangentSpace : VectorProtocol {
struct TangentSpace : AdditiveArithmetic {
let x, y: Float
}

Expand Down Expand Up @@ -81,7 +81,7 @@ E2EDifferentiablePropertyTests.test("generic stored property") {
expectEqual(expectedGrad, actualGrad)
}

struct ProductSpaceSelfTangent : VectorProtocol {
struct ProductSpaceSelfTangent : AdditiveArithmetic {
let x, y: Float
}

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

struct ProductSpaceOtherTangentTangentSpace : VectorProtocol {
struct ProductSpaceOtherTangentTangentSpace : AdditiveArithmetic {
let x, y: Float
}

Expand Down
6 changes: 3 additions & 3 deletions test/AutoDiff/forward_mode_runtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ ForwardModeTests.test("TupleNonDifferentiableElements") {
//===----------------------------------------------------------------------===//

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

let m: Float
Expand Down Expand Up @@ -832,7 +832,7 @@ extension DiffReq where TangentVector : AdditiveArithmetic {
}
}

struct Quadratic : DiffReq, VectorProtocol {
struct Quadratic : DiffReq, AdditiveArithmetic {
typealias TangentVector = Quadratic

@differentiable
Expand Down
2 changes: 1 addition & 1 deletion test/AutoDiff/generics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ _ = gradient(at: Float(1), in: { x in identity(x) })
// CHECK-SIL-NEXT: [[EMIT_ZERO_INDIRECT:%.*]] = apply [[ZERO_WITNESS]]<τ_0_0.TangentVector>([[ORIG_COTAN]], [[ORIG_COTAN_METATYPE]])
// CHECK-SIL: }

struct Tensor<Scalar : FloatingPoint & Differentiable> : VectorProtocol, Differentiable {
struct Tensor<Scalar : FloatingPoint & Differentiable> : Differentiable {
// NOTE: `value` must have type with known size (e.g. `Float`, not `Scalar`)
// until differentiation has indirect passing support.
var value: Float
Expand Down
4 changes: 2 additions & 2 deletions test/AutoDiff/method.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extension Parameter {
}
}

extension Parameter : Differentiable, VectorProtocol {
extension Parameter : Differentiable, AdditiveArithmetic {
typealias TangentVector = Parameter
typealias Scalar = Float
typealias Shape = ()
Expand Down Expand Up @@ -177,7 +177,7 @@ struct CustomParameter : Equatable {
}
}

extension CustomParameter : Differentiable, VectorProtocol {
extension CustomParameter : Differentiable, AdditiveArithmetic {
typealias TangentVector = CustomParameter
typealias Scalar = Float
typealias Shape = ()
Expand Down
2 changes: 1 addition & 1 deletion test/AutoDiff/protocol_requirement_autodiff.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension DiffReq where TangentVector : AdditiveArithmetic {
}
}

struct Quadratic : DiffReq, VectorProtocol {
struct Quadratic : DiffReq, AdditiveArithmetic {
typealias TangentVector = Quadratic

@differentiable
Expand Down
2 changes: 1 addition & 1 deletion test/AutoDiff/refcounting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class NonTrivialStuff : Equatable {
}

@frozen
public struct Vector : AdditiveArithmetic, VectorProtocol, Differentiable, Equatable {
public struct Vector : AdditiveArithmetic, Differentiable, Equatable {
public var x: Float
public var y: Float
public var nonTrivialStuff = NonTrivialStuff()
Expand Down
2 changes: 1 addition & 1 deletion test/AutoDiff/separate_tangent_type.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct DifferentiableSubset : Differentiable {
var b: Float
@noDerivative var flag: Bool

struct TangentVector : Differentiable, VectorProtocol {
struct TangentVector : Differentiable, AdditiveArithmetic {
typealias TangentVector = DifferentiableSubset.TangentVector
var w: Float
var b: Float
Expand Down
4 changes: 2 additions & 2 deletions test/AutoDiff/simple_model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct DenseLayer : Equatable {
let b: Float
}

extension DenseLayer : Differentiable, VectorProtocol {
extension DenseLayer : Differentiable, AdditiveArithmetic {
typealias TangentVector = DenseLayer
typealias Scalar = Float
static var zero: DenseLayer {
Expand Down Expand Up @@ -50,7 +50,7 @@ struct Model : Equatable {
let l3: DenseLayer
}

extension Model : Differentiable, VectorProtocol {
extension Model : Differentiable, AdditiveArithmetic {
typealias TangentVector = Model
typealias Scalar = Float
static var zero: Model {
Expand Down
2 changes: 1 addition & 1 deletion test/AutoDiff/simple_real_vector.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s

@frozen
public struct Vector : AdditiveArithmetic, VectorProtocol, Differentiable {
public struct Vector : AdditiveArithmetic, Differentiable {
public var x: Float
public var y: Float

Expand Down
2 changes: 1 addition & 1 deletion test/AutoDiff/witness_table_sil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ protocol Proto : Differentiable {
func function3(_ x: Float, _ y: Double) -> Double
}

struct S : Proto, VectorProtocol {
struct S : Proto, AdditiveArithmetic {
typealias Scalar = Float

@differentiable
Expand Down