Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit 4539792

Browse files
jon-towrxwei
authored andcommitted
Add @differentiable to Tensor pow(_:_:) and root(_:_:) (#368)
1 parent cf9ee4f commit 4539792

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/TensorFlow/Operators/Math.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,15 @@ extension Tensor: ElementaryFunctions where Scalar: TensorFlowFloatingPoint {
153153
/// For real types, if `x` is negative the result is NaN, even if `y` has
154154
/// an integral value. For complex types, there is a branch cut on the
155155
/// negative real axis.
156+
@differentiable
156157
public static func pow(_ x: Self, _ y: Self) -> Self {
157158
TensorFlow.pow(x, y)
158159
}
159160

160161
/// `x` raised to the `n`th power.
161162
///
162163
/// The product of `n` copies of `x`.
164+
@differentiable
163165
public static func pow(_ x: Self, _ n: Int) -> Self {
164166
TensorFlow.pow(x, n)
165167
}
@@ -168,6 +170,7 @@ extension Tensor: ElementaryFunctions where Scalar: TensorFlowFloatingPoint {
168170
///
169171
/// For real types, if `x` is negative and `n` is even, the result is NaN.
170172
/// For complex types, there is a branch cut along the negative real axis.
173+
@differentiable
171174
public static func root(_ x: Self, _ n: Int) -> Self {
172175
TensorFlow.root(x, n)
173176
}

0 commit comments

Comments
 (0)