mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Added support for convolution and reshaping of tensors.
This commit is contained in:
@@ -203,6 +203,13 @@ class TensorBase
|
||||
return TensorContractionOp<const Dimensions, const Derived, const OtherDerived>(derived(), other.derived(), dims);
|
||||
}
|
||||
|
||||
// Convolutions.
|
||||
template<typename KernelDerived, typename Dimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
const TensorConvolutionOp<const Dimensions, const Derived, const KernelDerived>
|
||||
convolve(const KernelDerived& kernel, const Dimensions& dims) const {
|
||||
return TensorConvolutionOp<const Dimensions, const Derived, const KernelDerived>(derived(), kernel.derived(), dims);
|
||||
}
|
||||
|
||||
// Coefficient-wise ternary operators.
|
||||
template<typename ThenDerived, typename ElseDerived>
|
||||
inline const TensorSelectOp<const Derived, const ThenDerived, const ElseDerived>
|
||||
@@ -210,6 +217,13 @@ class TensorBase
|
||||
return TensorSelectOp<const Derived, const ThenDerived, const ElseDerived>(derived(), thenTensor.derived(), elseTensor.derived());
|
||||
}
|
||||
|
||||
// Morphing operators (slicing tbd).
|
||||
template <typename NewDimensions>
|
||||
inline const TensorReshapingOp<const Derived, const NewDimensions>
|
||||
reshape(const NewDimensions& newDimensions) const {
|
||||
return TensorReshapingOp<const Derived, const NewDimensions>(derived(), newDimensions);
|
||||
}
|
||||
|
||||
// Select the device on which to evaluate the expression.
|
||||
template <typename DeviceType>
|
||||
TensorDevice<Derived, DeviceType> device(const DeviceType& device) {
|
||||
|
||||
Reference in New Issue
Block a user