Avatar
@swift-main -enable-experimental-forward-mode-differentiation import _Differentiation @differentiable(reverse) func x_2(_ x: Double) -> Double { return x * x } let x: Double = 1.0 let grad_x = gradient(of: { (x: Double) in x_2(x) })(x) print(grad_x)