mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-12 09:23:12 +08:00
Reimplement clamp as a static function.
This commit is contained in:
parent
e96d36d4cd
commit
e2946d962d
@ -708,9 +708,6 @@ struct TensorEvaluator<const TensorStridingSlicingOp<StartIndices, StopIndices,
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device)
|
||||
: m_impl(op.expression(), device), m_device(device), m_strides(op.strides())
|
||||
{
|
||||
auto clamp = [](Index value, Index min, Index max){
|
||||
return numext::maxi(min,numext::mini(max,value));
|
||||
};
|
||||
// Handle degenerate intervals by gracefully clamping and allowing m_dimensions to be zero
|
||||
DSizes<Index,NumDims> startIndicesClamped, stopIndicesClamped;
|
||||
for (int i = 0; i < internal::array_size<Dimensions>::value; ++i) {
|
||||
@ -834,6 +831,10 @@ struct TensorEvaluator<const TensorStridingSlicingOp<StartIndices, StopIndices,
|
||||
return inputIndex;
|
||||
}
|
||||
|
||||
static EIGEN_STRONG_INLINE Index clamp(Index value, Index min, Index max) {
|
||||
return numext::maxi(min, numext::mini(max,value));
|
||||
}
|
||||
|
||||
array<Index, NumDims> m_outputStrides;
|
||||
array<internal::TensorIntDivisor<Index>, NumDims> m_fastOutputStrides;
|
||||
array<Index, NumDims> m_inputStrides;
|
||||
|
Loading…
x
Reference in New Issue
Block a user