Skip to content

Commit fb6045c

Browse files
authored
[AutoDiff] Underscore the Differentiable protocol. (#27577)
Rename the `Differentiable` protocol to `_Differentiable`. This matches upstreaming PR #27511, which adds `protocol _Differentiable` in a new `Differentiable.swift` file. `tensorflow` branch defines `typealias Differentiable = _Differentiable` for usability. There should be no user-facing changes, except that some error messages now show '_Differentiable' instead of 'Differentiable'.
1 parent 36676ae commit fb6045c

24 files changed

+144
-118
lines changed

include/swift/AST/KnownProtocols.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ PROTOCOL(KeyPathIterable)
8585
PROTOCOL(TensorArrayProtocol)
8686
PROTOCOL(TensorGroup)
8787
PROTOCOL(VectorProtocol)
88-
PROTOCOL(Differentiable)
8988
PROTOCOL(EuclideanDifferentiable)
89+
PROTOCOL(Expression)
9090

9191
PROTOCOL_(ObjectiveCBridgeable)
9292
PROTOCOL_(DestructorSafeContainer)
9393

9494
PROTOCOL(StringInterpolationProtocol)
9595

96+
PROTOCOL_(Differentiable)
97+
9698
EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByArrayLiteral, "Array", false)
9799
EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByBooleanLiteral, "BooleanLiteralType", true)
98100
EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByDictionaryLiteral, "Dictionary", false)
@@ -107,9 +109,9 @@ EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByUnicodeScalarLiteral, "UnicodeScala
107109
EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByColorLiteral, "_ColorLiteralType", true)
108110
EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByImageLiteral, "_ImageLiteralType", true)
109111
EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByFileReferenceLiteral, "_FileReferenceLiteralType", true)
112+
// SWIFT_ENABLE_TENSORFLOW
110113
// TODO(TF-735): Implement ExpressibleByQuoteLiteral.
111114
// EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByQuoteLiteral, "_QuoteLiteralType", true)
112-
PROTOCOL(Expression)
113115

114116
BUILTIN_EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByBuiltinBooleanLiteral)
115117
BUILTIN_EXPRESSIBLE_BY_LITERAL_PROTOCOL_(ExpressibleByBuiltinExtendedGraphemeClusterLiteral)

lib/AST/Builtins.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,11 +1007,8 @@ static ValueDecl *getAutoDiffApplyAssociatedFunction(
10071007
// rethrows -> (R, (R.TangentVector) -> ...T.TangentVector)
10081008
unsigned numGenericParams = 1 + arity;
10091009
BuiltinGenericSignatureBuilder builder(Context, numGenericParams);
1010-
// Look up the Differentiable protocol.
1011-
SmallVector<ValueDecl *, 1> diffableProtoLookup;
1012-
Context.lookupInSwiftModule("Differentiable", diffableProtoLookup);
1013-
assert(diffableProtoLookup.size() == 1);
1014-
auto *diffableProto = cast<ProtocolDecl>(diffableProtoLookup.front());
1010+
// Get the `Differentiable` protocol.
1011+
auto *diffableProto = Context.getProtocol(KnownProtocolKind::Differentiable);
10151012
// Create type parameters and add conformance constraints.
10161013
auto fnResultGen = makeGenericParam(arity);
10171014
builder.addConformanceRequirement(fnResultGen, diffableProto);

lib/IRGen/GenMeta.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4216,7 +4216,7 @@ SpecialProtocol irgen::getSpecialProtocolID(ProtocolDecl *P) {
42164216
case KnownProtocolKind::Encodable:
42174217
case KnownProtocolKind::Decodable:
42184218
case KnownProtocolKind::StringInterpolationProtocol:
4219-
case KnownProtocolKind::Expression:
4219+
case KnownProtocolKind::Differentiable:
42204220
// SWIFT_ENABLE_TENSORFLOW
42214221
case KnownProtocolKind::AdditiveArithmetic:
42224222
case KnownProtocolKind::PointwiseMultiplicative:
@@ -4225,8 +4225,8 @@ SpecialProtocol irgen::getSpecialProtocolID(ProtocolDecl *P) {
42254225
case KnownProtocolKind::TensorArrayProtocol:
42264226
case KnownProtocolKind::TensorGroup:
42274227
case KnownProtocolKind::VectorProtocol:
4228-
case KnownProtocolKind::Differentiable:
42294228
case KnownProtocolKind::EuclideanDifferentiable:
4229+
case KnownProtocolKind::Expression:
42304230
return SpecialProtocol::None;
42314231
}
42324232

stdlib/public/core/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ set(SWIFTLIB_ESSENTIAL
3030
ASCII.swift
3131
Assert.swift
3232
AssertCommon.swift
33-
# SWIFT_ENABLE_TENSORFLOW
34-
AutoDiff.swift
3533
BidirectionalCollection.swift
3634
Bitset.swift
3735
Bool.swift
@@ -208,6 +206,9 @@ set(SWIFTLIB_SOURCES
208206
CollectionDifference.swift
209207
CollectionOfOne.swift
210208
Diffing.swift
209+
Differentiable.swift
210+
# SWIFT_ENABLE_TENSORFLOW
211+
DifferentiationSupport.swift
211212
Mirror.swift
212213
PlaygroundDisplay.swift
213214
CommandLine.swift
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//===--- Differentiable.swift ---------------------------------*- swift -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// This file defines the Differentiable protocol, used by the experimental
14+
// differentiable programming project. Please see forum discussion for more
15+
// information:
16+
// https://forums.swift.org/t/differentiable-programming-mega-proposal/28547
17+
//
18+
//===----------------------------------------------------------------------===//
19+
20+
/// A type that mathematically represents a differentiable manifold whose
21+
/// tangent spaces are finite-dimensional.
22+
public protocol _Differentiable {
23+
/// A type representing a differentiable value's derivatives.
24+
///
25+
/// Mathematically, this is equivalent to the tangent bundle of the
26+
/// differentiable manifold represented by the differentiable type.
27+
associatedtype TangentVector: _Differentiable & AdditiveArithmetic
28+
where TangentVector.TangentVector == TangentVector
29+
30+
/// Moves `self` along the given direction. In Riemannian geometry, this is
31+
/// equivalent to exponential map, which moves `self` on the geodesic surface
32+
/// along the given tangent vector.
33+
mutating func move(along direction: TangentVector)
34+
35+
// SWIFT_ENABLE_TENSORFLOW
36+
/// A tangent vector such that `move(along: zeroTangentVector)` will not
37+
/// modify `self`.
38+
/// - Note: `zeroTangentVector` can be `TangentVector.zero` in most cases,
39+
/// but types whose tangent vectors depend on instance properties of `self`
40+
/// need to provide a different implementation. For example, the tangent
41+
/// vector of an `Array` depends on the array's `count`.
42+
@available(*, deprecated, message: """
43+
`zeroTangentVector` derivation has not been implemented; do not use \
44+
this property
45+
""")
46+
var zeroTangentVector: TangentVector { get }
47+
}
48+
49+
public extension _Differentiable where TangentVector == Self {
50+
mutating func move(along direction: TangentVector) {
51+
self += direction
52+
}
53+
}
54+
55+
public extension _Differentiable {
56+
// This is a temporary solution that allows us to add `zeroTangentVector`
57+
// without implementing derived conformances. This property is marked
58+
// unavailable because it will produce incorrect results when tangent vectors
59+
// depend on instance properties of `self`.
60+
// FIXME: Implement derived conformance and remove this default
61+
// implementation.
62+
var zeroTangentVector: TangentVector { .zero }
63+
}
64+
65+
// SWIFT_ENABLE_TENSORFLOW
66+
public typealias Differentiable = _Differentiable

stdlib/public/core/AutoDiff.swift renamed to stdlib/public/core/DifferentiationSupport.swift

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
//===--- AutoDiff.swift ---------------------------------------*- swift -*-===//
1+
//===--- DifferentiationSupport.swift -------------------------*- swift -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -12,7 +12,8 @@
1212
//
1313
// SWIFT_ENABLE_TENSORFLOW
1414
//
15-
// This file defines support for automatic differentiation.
15+
// This file defines support for differentiable programming and deep learning
16+
// APIs.
1617
//
1718
//===----------------------------------------------------------------------===//
1819

@@ -101,8 +102,9 @@ public extension VectorProtocol {
101102
}
102103
}
103104

104-
/* Note: These default-implemented operators will slow down type-checking
105-
performance and break existing code.
105+
/*
106+
// Note: These default-implemented operators will slow down type-checking
107+
// performance and break existing code.
106108

107109
public extension VectorProtocol {
108110
static func + (lhs: Self, rhs: VectorSpaceScalar) -> Self {
@@ -149,50 +151,6 @@ public extension VectorProtocol where VectorSpaceScalar : SignedNumeric {
149151
}
150152
*/
151153

152-
/// A type that mathematically represents a differentiable manifold whose
153-
/// tangent spaces are finite-dimensional.
154-
public protocol Differentiable {
155-
/// A type representing a differentiable value’s derivatives.
156-
///
157-
/// Mathematically, this is equivalent to the tangent bundle of the
158-
/// differentiable manifold represented by the differentiable type.
159-
associatedtype TangentVector: Differentiable & AdditiveArithmetic
160-
where TangentVector.TangentVector == TangentVector
161-
162-
/// Moves `self` along the given direction. In Riemannian geometry, this is
163-
/// equivalent to exponential map, which moves `self` on the geodesic surface
164-
/// along the given tangent vector.
165-
mutating func move(along direction: TangentVector)
166-
167-
/// A tangent vector such that `move(along: zeroTangentVector)` will not
168-
/// modify `self`.
169-
/// - Note: `zeroTangentVector` can be `TangentVector.zero` in most cases,
170-
/// but types whose tangent vectors depend on instance properties of `self`
171-
/// need to provide a different implementation. For example, the tangent
172-
/// vector of an `Array` depends on the array’s `count`.
173-
@available(*, deprecated, message: """
174-
`zeroTangentVector` derivation has not been implemented; do not use \
175-
this property
176-
""")
177-
var zeroTangentVector: TangentVector { get }
178-
}
179-
180-
public extension Differentiable {
181-
// This is a temporary solution that allows us to add `zeroTangentVector`
182-
// without implementing derived conformances. This property is marked
183-
// unavailable because it will produce incorrect results when tangent vectors
184-
// depend on instance properties of `self`.
185-
// FIXME: Implement derived conformance and remove this default
186-
// implementation.
187-
var zeroTangentVector: TangentVector { .zero }
188-
}
189-
190-
public extension Differentiable where TangentVector == Self {
191-
mutating func move(along direction: TangentVector) {
192-
self += direction
193-
}
194-
}
195-
196154
/// A type that is differentiable in the Euclidean space.
197155
/// The type may represent a vector space, or consist of a vector space and some
198156
/// other non-differentiable component.
@@ -1077,8 +1035,9 @@ public extension Array where Element: Differentiable {
10771035
}
10781036

10791037
//===----------------------------------------------------------------------===//
1080-
// JVP Diagnostics
1038+
// JVP diagnostics
10811039
//===----------------------------------------------------------------------===//
1040+
10821041
@_silgen_name("_printJVPErrorAndExit")
10831042
public func _printJVPErrorAndExit() -> Never {
10841043
fatalError("""

stdlib/public/core/GroupInfo.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@
171171
"SIMDVector.swift",
172172
"SIMDVectorTypes.swift"]}
173173
],
174-
"AutoDiff": [
175-
"AutoDiff.swift",
176-
],
177174
"Optional": [
178175
"Optional.swift"
179176
],
@@ -231,5 +228,9 @@
231228
],
232229
"Result": [
233230
"Result.swift"
231+
],
232+
"DifferentiableProgramming": [
233+
"Differentiable.swift",
234+
"DifferentiationSupport.swift"
234235
]
235236
}

test/AutoDiff/derived_differentiable.swift

Lines changed: 7 additions & 7 deletions
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, VectorProtocol
4848
// CHECK-AST: internal typealias TangentVector = TestNoDerivative.TangentVector
4949
// CHECK-AST: internal var differentiableVectorView: TestNoDerivative.TangentVector { get }
5050

@@ -57,7 +57,7 @@ struct TestPointwiseMultiplicative : Differentiable {
5757
// CHECK-AST: var w: PointwiseMultiplicativeDummy
5858
// CHECK-AST: @noDerivative internal var technicallyDifferentiable: PointwiseMultiplicativeDummy
5959
// CHECK-AST: internal init(w: PointwiseMultiplicativeDummy, technicallyDifferentiable: PointwiseMultiplicativeDummy)
60-
// CHECK-AST: internal struct TangentVector : Differentiable, AdditiveArithmetic, PointwiseMultiplicative
60+
// CHECK-AST: internal struct TangentVector : _Differentiable, AdditiveArithmetic, PointwiseMultiplicative
6161
// CHECK-AST: internal typealias TangentVector = TestPointwiseMultiplicative.TangentVector
6262

6363

@@ -70,14 +70,14 @@ struct TestKeyPathIterable : Differentiable, KeyPathIterable {
7070
// CHECK-AST: var w: Float
7171
// CHECK-AST: @noDerivative internal var technicallyDifferentiable: Float
7272
// CHECK-AST: internal init(w: Float, technicallyDifferentiable: Float)
73-
// CHECK-AST: internal struct TangentVector : Differentiable, AdditiveArithmetic, ElementaryFunctions, VectorProtocol, KeyPathIterable
73+
// CHECK-AST: internal struct TangentVector : _Differentiable, AdditiveArithmetic, ElementaryFunctions, VectorProtocol, KeyPathIterable
7474
// CHECK-AST: internal typealias TangentVector = TestKeyPathIterable.TangentVector
7575

7676
struct GenericTanMember<T : Differentiable> : Differentiable, AdditiveArithmetic {
7777
var x: T.TangentVector
7878
}
7979

80-
// CHECK-AST-LABEL: internal struct GenericTanMember<T> : Differentiable, AdditiveArithmetic where T : Differentiable
80+
// CHECK-AST-LABEL: internal struct GenericTanMember<T> : Differentiable, AdditiveArithmetic where T : _Differentiable
8181
// CHECK-AST: internal var x: T.TangentVector
8282
// CHECK-AST: internal init(x: T.TangentVector)
8383
// CHECK-AST: internal typealias TangentVector = GenericTanMember<T>
@@ -92,7 +92,7 @@ public struct ConditionallyDifferentiable<T> {
9292
extension ConditionallyDifferentiable : Differentiable where T : Differentiable {}
9393

9494
// CHECK-AST-LABEL: public struct ConditionallyDifferentiable<T> {
95-
// CHECK-AST: @differentiable(wrt: self where T : Differentiable)
95+
// CHECK-AST: @differentiable(wrt: self where T : _Differentiable)
9696
// CHECK-AST: public var x: T
9797
// CHECK-AST: internal init(x: T)
9898
// CHECK-AST: }
@@ -121,7 +121,7 @@ final class AdditiveArithmeticClass<T : AdditiveArithmetic & Differentiable> : A
121121
}
122122
}
123123

124-
// CHECK-AST-LABEL: final internal class AdditiveArithmeticClass<T> : AdditiveArithmetic, Differentiable where T : AdditiveArithmetic, T : Differentiable {
124+
// CHECK-AST-LABEL: final internal class AdditiveArithmeticClass<T> : AdditiveArithmetic, Differentiable where T : AdditiveArithmetic, T : _Differentiable {
125125
// CHECK-AST: final internal var x: T, y: T
126-
// CHECK-AST: internal struct TangentVector : Differentiable, AdditiveArithmetic
126+
// CHECK-AST: internal struct TangentVector : _Differentiable, AdditiveArithmetic
127127
// CHECK-AST: }

test/AutoDiff/differentiable_attr_silgen.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public func foo_indir_ret<T: Differentiable>(_ x: Float, _ y: T) -> T {
3030
return y
3131
}
3232

33-
// CHECK-SIL-LABEL: sil [differentiable source 0 wrt 0, 1 vjp @AD__foo_indir_ret__vjp_src_0_wrt_0_1] [ossa] @foo_indir_ret : $@convention(thin) <T where T : Differentiable> (Float, @in_guaranteed T) -> @out T {
33+
// CHECK-SIL-LABEL: sil [differentiable source 0 wrt 0, 1 vjp @AD__foo_indir_ret__vjp_src_0_wrt_0_1] [ossa] @foo_indir_ret : $@convention(thin) <T where T : _Differentiable> (Float, @in_guaranteed T) -> @out T {
3434
// CHECK-SIL: bb0(%0 : $*T, %1 : $Float, %2 : $*T):
3535

3636
@_silgen_name("dfoo_indir_ret")
@@ -101,7 +101,7 @@ struct DiffComputedProp : Differentiable & AdditiveArithmetic {
101101
// Check that `@differentiable` attribute is transferred from computed property
102102
// storage declaration to getter accessor.
103103

104-
// CHECK-AST: struct DiffComputedProp : AdditiveArithmetic & Differentiable {
104+
// CHECK-AST: struct DiffComputedProp : _Differentiable & AdditiveArithmetic {
105105
// CHECK-AST-NEXT: var computedProp: Float { get }
106106
// CHECK-AST: }
107107

test/AutoDiff/differentiable_attr_type_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ struct TF_521<T: FloatingPoint> {
765765
self.imaginary = imaginary
766766
}
767767
}
768-
// expected-error @+2 {{type 'TF_521<T>' does not conform to protocol 'Differentiable'}}
768+
// expected-error @+2 {{type 'TF_521<T>' does not conform to protocol '_Differentiable'}}
769769
// expected-note @+1 {{do you want to add protocol stubs}}
770770
extension TF_521: Differentiable where T: Differentiable {
771771
// expected-note @+1 {{possibly intended match 'TF_521<T>.TangentVector' does not conform to 'AdditiveArithmetic'}}

test/AutoDiff/differentiable_func_debuginfo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// Conclusion: mangling coverage is important.
2424

2525
// Minimal dummy compiler-known `Differentiable` protocol.
26-
public protocol Differentiable {
26+
public protocol _Differentiable {
2727
associatedtype TangentVector
2828
}
2929

test/AutoDiff/differentiable_func_type_type_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ extension Vector: Differentiable where T: Differentiable {}
9292
func inferredConformancesGeneric<T, U>(_: @differentiable (Vector<T>) -> Vector<U>) {}
9393

9494
func nondiffVectorFunc(x: Vector<Int>) -> Vector<Int> {}
95-
// expected-error @+1 {{global function 'inferredConformancesGeneric' requires that 'Int' conform to 'Differentiable}}
95+
// expected-error @+1 {{global function 'inferredConformancesGeneric' requires that 'Int' conform to '_Differentiable}}
9696
inferredConformancesGeneric(nondiffVectorFunc)
9797

9898
func diffVectorFunc(x: Vector<Float>) -> Vector<Float> {}

test/AutoDiff/differentiable_function_silgen.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ func appliesReabstraction(_ f: @escaping @differentiable (Float) -> Float) {
8484
// CHECK-SILGEN: [[REABS_VJP:%.*]] = function_ref @$sS4fIegyd_Iegydo_S4fIegnr_Iegnro_TR : $@convention(thin) (@in_guaranteed Float, @guaranteed @callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float)
8585
// CHECK-SILGEN: [[NEW_VJP:%.*]] = partial_apply [callee_guaranteed] [[REABS_VJP]]([[VJP_COPY]]) : $@convention(thin) (@in_guaranteed Float, @guaranteed @callee_guaranteed (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float)
8686
// CHECK-SILGEN: [[NEW_DIFF_FUNC:%.*]] = differentiable_function [wrt 0] [order 1] [[NEW_ORIG]] : $@callee_guaranteed (@in_guaranteed Float) -> @out Float with {[[NEW_JVP]] : $@callee_guaranteed (@in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float), [[NEW_VJP]] : $@callee_guaranteed (@in_guaranteed Float) -> (@out Float, @owned @callee_guaranteed (@in_guaranteed Float) -> @out Float)}
87-
// CHECK-SILGEN: [[DIFF_API:%.*]] = function_ref @${{.*}}pullback{{.*}}at{{.*}} : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : Differentiable, τ_0_1 : Differentiable> (@in_guaranteed τ_0_0, @guaranteed @differentiable @callee_guaranteed (@in_guaranteed τ_0_0) -> @out τ_0_1) -> @owned @callee_guaranteed (@in_guaranteed τ_0_1.TangentVector) -> @out τ_0_0.TangentVector
88-
// CHECK-SILGEN: apply [[DIFF_API]]<Float, Float>({{.*}}, [[NEW_DIFF_FUNC]]) : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : Differentiable, τ_0_1 : Differentiable> (@in_guaranteed τ_0_0, @guaranteed @differentiable @callee_guaranteed (@in_guaranteed τ_0_0) -> @out τ_0_1) -> @owned @callee_guaranteed (@in_guaranteed τ_0_1.TangentVector) -> @out τ_0_0.TangentVector
87+
// CHECK-SILGEN: [[DIFF_API:%.*]] = function_ref @${{.*}}pullback{{.*}}at{{.*}} : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : _Differentiable, τ_0_1 : _Differentiable> (@in_guaranteed τ_0_0, @guaranteed @differentiable @callee_guaranteed (@in_guaranteed τ_0_0) -> @out τ_0_1) -> @owned @callee_guaranteed (@in_guaranteed τ_0_1.TangentVector) -> @out τ_0_0.TangentVector
88+
// CHECK-SILGEN: apply [[DIFF_API]]<Float, Float>({{.*}}, [[NEW_DIFF_FUNC]]) : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : _Differentiable, τ_0_1 : _Differentiable> (@in_guaranteed τ_0_0, @guaranteed @differentiable @callee_guaranteed (@in_guaranteed τ_0_0) -> @out τ_0_1) -> @owned @callee_guaranteed (@in_guaranteed τ_0_1.TangentVector) -> @out τ_0_0.TangentVector

0 commit comments

Comments
 (0)