File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ public struct SIMD${n}<Scalar>: SIMD where Scalar: SIMDScalar {
45
45
}
46
46
47
47
/// Accesses the scalar at the specified position.
48
+ @differentiable ( vjp: _vjpSubscript
49
+ where Scalar : EuclideanDifferentiable & BinaryFloatingPoint,
50
+ Scalar . TangentVector : BinaryFloatingPoint)
48
51
public subscript( index: Int) - > Scalar {
49
52
@_transparent get {
50
53
_precondition ( indices. contains ( index) )
@@ -203,9 +206,8 @@ extension SIMD${n}
203
206
where Scalar : EuclideanDifferentiable & BinaryFloatingPoint,
204
207
Scalar . TangentVector : BinaryFloatingPoint {
205
208
@usableFromInline
206
- @derivative ( of: subscript ( index: ) )
207
209
internal func _vjpSubscript( index: Int )
208
- -> ( value : Scalar , pullback : ( Scalar . TangentVector ) -> TangentVector ) {
210
+ -> ( Scalar , ( Scalar . TangentVector ) -> TangentVector ) {
209
211
return ( self [ index] , { v in
210
212
var zeros = Self . zero
211
213
zeros [ index] = Scalar ( v)
You can’t perform that action at this time.
0 commit comments