We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
transpose(of:)
1 parent 0e8a67f commit e1514cfCopy full SHA for e1514cf
stdlib/public/Differentiation/DifferentiationSupport.swift
@@ -368,12 +368,13 @@ public extension Differentiable {
368
369
// Transpose
370
371
-@available(*, unavailable)
372
@inlinable
373
public func transpose<T, R>(
374
- of body: @escaping @differentiable/*(linear)*/ (T) -> R
375
-) -> @differentiable/*(linear)*/ (R) -> T {
376
- fatalError()
+ of body: @escaping @differentiable(linear) (T) -> R
+) -> @differentiable(linear) (R) -> T {
+ let original = body as (T) -> R
+ let transpose = { x in Builtin.applyTranspose_arity1(body, x) }
377
+ return Builtin.linearFunction_arity1(transpose, original)
378
}
379
380
// Value with differential
0 commit comments