@@ -930,6 +930,7 @@ public extension Tensor where Scalar: Numeric & Comparable {
930
930
// NOTE: This overload is necessary, otherwise `min()` would refer to the variadic method
931
931
// `min(squeezingAxes:)` with zero indices.
932
932
@inlinable
933
+ @differentiable ( where Scalar: TensorFlowFloatingPoint)
933
934
func min( ) -> Tensor {
934
935
let axes = Tensor < Int32 > ( rangeFrom: 0 , to: Int32 ( rank) , stride: 1 )
935
936
return min ( squeezingAxes: axes)
@@ -938,6 +939,7 @@ public extension Tensor where Scalar: Numeric & Comparable {
938
939
// NOTE: This overload is necessary, otherwise `max()` would refer to the variadic method
939
940
// `max(squeezingAxes:)` with zero indices.
940
941
@inlinable
942
+ @differentiable ( where Scalar: TensorFlowFloatingPoint)
941
943
func max( ) -> Tensor {
942
944
let axes = Tensor < Int32 > ( rangeFrom: 0 , to: Int32 ( rank) , stride: 1 )
943
945
return max ( squeezingAxes: axes)
@@ -958,15 +960,18 @@ public extension Tensor where Scalar: Numeric & Comparable {
958
960
/// - Parameter axes: The dimensions to reduce.
959
961
/// - Precondition: Each value in `axes` must be in the range `-rank..<rank`.
960
962
@inlinable
963
+ @differentiable ( wrt: self where Scalar: TensorFlowFloatingPoint)
961
964
func max( squeezingAxes axes: [ Int ] ) -> Tensor {
962
- let axes = axes. map ( Int32 . init)
965
+ // TODO(TF-433): Remove workaround for differentiating `map`.
966
+ let axes = { axes. map ( Int32 . init) } ( )
963
967
return max ( squeezingAxes: Tensor < Int32 > ( axes) )
964
968
}
965
969
966
970
/// Returns the maximum values along the specified axes. The reduced dimensions are removed.
967
971
/// - Parameter axes: The dimensions to reduce.
968
972
/// - Precondition: Each value in `axes` must be in the range `-rank..<rank`.
969
973
@inlinable
974
+ @differentiable ( wrt: self where Scalar: TensorFlowFloatingPoint)
970
975
func max( squeezingAxes axes: Int ... ) -> Tensor {
971
976
return max ( squeezingAxes: axes)
972
977
}
@@ -986,15 +991,18 @@ public extension Tensor where Scalar: Numeric & Comparable {
986
991
/// - Parameter axes: The dimensions to reduce.
987
992
/// - Precondition: Each value in `axes` must be in the range `-rank..<rank`.
988
993
@inlinable
994
+ @differentiable ( wrt: self where Scalar: TensorFlowFloatingPoint)
989
995
func min( squeezingAxes axes: [ Int ] ) -> Tensor {
990
- let axes = axes. map ( Int32 . init)
996
+ // TODO(TF-433): Remove workaround for differentiating `map`.
997
+ let axes = { axes. map ( Int32 . init) } ( )
991
998
return min ( squeezingAxes: Tensor < Int32 > ( axes) )
992
999
}
993
1000
994
1001
/// Returns the minimum values along the specified axes. The reduced dimensions are removed.
995
1002
/// - Parameter axes: The dimensions to reduce.
996
1003
/// - Precondition: Each value in `axes` must be in the range `-rank..<rank`.
997
1004
@inlinable
1005
+ @differentiable ( wrt: self where Scalar: TensorFlowFloatingPoint)
998
1006
func min( squeezingAxes axes: Int ... ) -> Tensor {
999
1007
return min ( squeezingAxes: axes)
1000
1008
}
0 commit comments