mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add tensor scan op
This is the initial implementation a generic scan operation. Based on this, cumsum and cumprod method have been added to TensorBase.
This commit is contained in:
@@ -453,6 +453,21 @@ class TensorBase<Derived, ReadOnlyAccessors>
|
||||
return TensorFFTOp<const FFT, const Derived, FFTDataType, FFTDirection>(derived(), fft);
|
||||
}
|
||||
|
||||
// Scan.
|
||||
typedef TensorScanOp<internal::SumReducer<CoeffReturnType>, const Derived> TensorScanSumOp;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
const TensorScanSumOp
|
||||
cumsum(const Index& axis) const {
|
||||
return TensorScanSumOp(derived(), axis);
|
||||
}
|
||||
|
||||
typedef TensorScanOp<internal::ProdReducer<CoeffReturnType>, const Derived> TensorScanProdOp;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
const TensorScanProdOp
|
||||
cumprod(const Index& axis) const {
|
||||
return TensorScanProdOp(derived(), axis);
|
||||
}
|
||||
|
||||
// Reductions.
|
||||
template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
const TensorReductionOp<internal::SumReducer<CoeffReturnType>, const Dims, const Derived>
|
||||
|
||||
Reference in New Issue
Block a user