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

Add @differentiable to Tensor pow(_:_:) and root(_:_:) #368

Merged
merged 1 commit into from
Jul 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sources/TensorFlow/Operators/Math.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,15 @@ extension Tensor: ElementaryFunctions where Scalar: TensorFlowFloatingPoint {
/// For real types, if `x` is negative the result is NaN, even if `y` has
/// an integral value. For complex types, there is a branch cut on the
/// negative real axis.
@differentiable
public static func pow(_ x: Self, _ y: Self) -> Self {
TensorFlow.pow(x, y)
}

/// `x` raised to the `n`th power.
///
/// The product of `n` copies of `x`.
@differentiable
public static func pow(_ x: Self, _ n: Int) -> Self {
TensorFlow.pow(x, n)
}
Expand All @@ -168,6 +170,7 @@ extension Tensor: ElementaryFunctions where Scalar: TensorFlowFloatingPoint {
///
/// For real types, if `x` is negative and `n` is even, the result is NaN.
/// For complex types, there is a branch cut along the negative real axis.
@differentiable
public static func root(_ x: Self, _ n: Int) -> Self {
TensorFlow.root(x, n)
}
Expand Down