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

Commit e975f2b

Browse files
committed
conformance to Scalar:Numeric
1 parent 3739afa commit e975f2b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Sources/TensorFlow/Operators/Basic.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,6 @@ public extension Tensor {
214214
return Raw.squeeze(self, squeezeDims: axes.map(Int32.init))
215215
}
216216

217-
/// Returns a `Tensor` by clipping tensor values to a specified min and max.
218-
@inlinable
219-
@differentiable(wrt: self where Scalar: TensorFlowFloatingPoint)
220-
func clipped<T>(min minimum: Tensor<T>, max maximum: Tensor<T>) -> Tensor{
221-
return Raw.clipByValue(t: self, clipValueMin: minimum, clipValueMax: maximum)
222-
}
223217
}
224218

225219
internal extension Tensor where Scalar: TensorFlowFloatingPoint {
@@ -617,6 +611,14 @@ public extension Tensor {
617611
}
618612

619613
public extension Tensor where Scalar: Numeric {
614+
615+
/// Returns a `Tensor` by clipping tensor values to a specified min and max.
616+
@inlinable
617+
@differentiable(wrt: self where Scalar: TensorFlowFloatingPoint)
618+
func clipped(min minimum: Tensor, max maximum: Tensor) -> Tensor{
619+
return Raw.clipByValue(t: self, clipValueMin: minimum, clipValueMax: maximum)
620+
}
621+
620622
@inlinable
621623
@differentiable(wrt: self where Scalar: TensorFlowFloatingPoint)
622624
func unbroadcasted(toShape otherShape: Tensor<Int32>) -> Tensor {

0 commit comments

Comments
 (0)