Files
swift-mirror/test/AutoDiff/Sema/DerivativeRegistrationCrossModule/Inputs/b.swift
Richard Wei 8bc6143a4c [AutoDiff] Rename 'move(along:)' to 'move(by:)'.
Rename `move(along:)` to `move(by:)` based on the proposal feedback. The main argument for the change is that tangent vectors specify both a direction and a magnitude, whereas `along:` does not indicate that `self` is being moved by the specified magnitude.
2021-02-23 21:45:01 -05:00

14 lines
345 B
Swift

import _Differentiation
import a
extension Struct: Differentiable {
public struct TangentVector: Differentiable & AdditiveArithmetic {}
public mutating func move(by _: TangentVector) {}
@usableFromInline
@derivative(of: method, wrt: x)
func vjpMethod(_ x: Float) -> (value: Float, pullback: (Float) -> Float) {
(x, { $0 })
}
}