Skip to content

Commit 51d7d6a

Browse files
authored
[Docs] Minor edits to differentiable programming manifesto. (swiftlang#28200)
Polish "zero tangent vector initialization" doc comments.
1 parent c5c3c4e commit 51d7d6a

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

docs/DifferentiableProgramming.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -971,21 +971,20 @@ public protocol Differentiable {
971971

972972
/// A closure that produces a zero tangent vector and does not capture `self`.
973973
///
974-
/// A zero tangent vector of `self` is equal to `TangentVector.zero`
975-
/// sometimes. In some cases, the zero tangent vector dependes on
976-
/// information on `self`, such as shape. For differentiable programming, it
977-
/// is more memory-efficient to define a custom
978-
/// `zeroTangentVectorInitializer` to return a closure that captures and
979-
/// uses such information to create a zero tangent vector. For example:
974+
/// In some cases, the zero tangent vector of `self` is equal to
975+
/// `TangentVector.zero`. In other cases, the zero tangent vector depends on
976+
/// information in `self`, such as shape for an n-dimensional array type.
977+
/// For differentiable programming, it is more memory-efficient to define a
978+
/// custom `zeroTangentVectorInitializer` property which returns a closure
979+
/// that captures and uses only the necessary information to create a zero
980+
/// tangent vector. For example:
980981
///
981982
/// ```swift
982983
/// struct Vector {
983-
/// var scalars: [Float]
984-
/// var count: Int { scalars.count }
985-
/// init(repeating repeatedElement: Float, count: Int) { ... }
984+
/// var scalars: [Float]
985+
/// var count: Int { scalars.count }
986+
/// init(repeating repeatedElement: Float, count: Int) { ... }
986987
/// }
987-
///
988-
/// ...
989988
///
990989
/// extension Vector: Differentiable {
991990
/// typealias TangentVector = Vector

0 commit comments

Comments
 (0)