Go to the documentation of this file.
10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_INFLATION_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_INFLATION_H
23 template<
typename Str
ides,
typename XprType>
30 typedef typename XprType::Nested
Nested;
32 static const int NumDimensions = XprTraits::NumDimensions;
33 static const int Layout = XprTraits::Layout;
37 template<
typename Str
ides,
typename XprType>
43 template<
typename Str
ides,
typename XprType>
51 template<
typename Str
ides,
typename XprType>
78 template<
typename Str
ides,
typename ArgType,
typename Device>
107 : m_impl(op.expression(), device), m_strides(op.
strides())
109 m_dimensions = m_impl.dimensions();
111 for (
int i = 0;
i < NumDims; ++
i) {
112 m_dimensions[
i] = (m_dimensions[
i] - 1) * op.
strides()[
i] + 1;
116 for (
int i = 0;
i < NumDims; ++
i) {
122 m_outputStrides[0] = 1;
123 m_inputStrides[0] = 1;
124 for (
int i = 1;
i < NumDims; ++
i) {
125 m_outputStrides[
i] = m_outputStrides[
i-1] * m_dimensions[
i-1];
126 m_inputStrides[
i] = m_inputStrides[
i-1] * input_dims[
i-1];
129 m_outputStrides[NumDims-1] = 1;
130 m_inputStrides[NumDims-1] = 1;
131 for (
int i = NumDims - 2;
i >= 0; --
i) {
132 m_outputStrides[
i] = m_outputStrides[
i+1] * m_dimensions[
i+1];
133 m_inputStrides[
i] = m_inputStrides[
i+1] * input_dims[
i+1];
141 m_impl.evalSubExprsIfNeeded(
NULL);
156 for (
int i = NumDims - 1;
i > 0; --
i) {
157 const Index idx = index / m_outputStrides[
i];
158 if (idx != idx / m_fastStrides[
i] * m_strides[
i]) {
161 *inputIndex += idx / m_strides[
i] * m_inputStrides[
i];
162 index -= idx * m_outputStrides[
i];
164 if (index != index / m_fastStrides[0] * m_strides[0]) {
167 *inputIndex += index / m_strides[0];
171 for (
int i = 0;
i < NumDims - 1; ++
i) {
172 const Index idx = index / m_outputStrides[
i];
173 if (idx != idx / m_fastStrides[
i] * m_strides[
i]) {
176 *inputIndex += idx / m_strides[
i] * m_inputStrides[
i];
177 index -= idx * m_outputStrides[
i];
179 if (index != index / m_fastStrides[NumDims-1] * m_strides[NumDims-1]) {
182 *inputIndex += index / m_strides[NumDims - 1];
189 Index inputIndex = 0;
190 if (getInputIndex(index, &inputIndex)) {
191 return m_impl.coeff(inputIndex);
199 template<
int LoadMode>
215 const double compute_cost = NumDims * (3 * TensorOpCost::DivCost<Index>() +
216 3 * TensorOpCost::MulCost<Index>() +
217 2 * TensorOpCost::AddCost<Index>());
218 const double input_size = m_impl.dimensions().TotalSize();
219 const double output_size = m_dimensions.TotalSize();
220 if (output_size == 0)
222 return m_impl.costPerCoeff(vectorized) +
229 #ifdef EIGEN_USE_SYCL
247 #endif // EIGEN_CXX11_TENSOR_TENSOR_INFLATION_H
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Dimensions & dimensions() const
remove_reference< Nested >::type _Nested
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
const EIGEN_DEVICE_FUNC internal::remove_all< typename XprType::Nested >::type & expression() const
XprTraits::StorageKind StorageKind
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
#define EIGEN_DEVICE_FUNC
PacketType< CoeffReturnType, Device >::type PacketReturnType
Namespace containing all symbols from the Eigen library.
Eigen::internal::traits< TensorInflationOp >::StorageKind StorageKind
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
EIGEN_ALWAYS_INLINE DSizes< IndexType, NumDims > strides(const DSizes< IndexType, NumDims > &dimensions)
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Eigen::internal::traits< TensorInflationOp >::Index Index
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
TensorInflationOp< Strides, XprType > type
const typedef TensorInflationOp< Strides, XprType > & type
static const int PacketSize
DSizes< Index, NumDims > Dimensions
EIGEN_STRONG_INLINE void cleanup()
internal::TensorBlockNotImplemented TensorBlock
XprType::CoeffReturnType CoeffReturnType
Eigen::internal::traits< TensorInflationOp >::Scalar Scalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool getInputIndex(Index index, Index *inputIndex) const
#define EIGEN_STRONG_INLINE
#define EIGEN_UNROLL_LOOP
Eigen::internal::nested< TensorInflationOp >::type Nested
TensorEvaluator< ArgType, Device > m_impl
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorInflationOp(const XprType &expr, const Strides &strides)
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Eigen::NumTraits< Scalar >::Real RealScalar
StorageMemory< CoeffReturnType, Device > Storage
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Dimensions & dimensions() const
EIGEN_STRONG_INLINE TensorEvaluator(const XprType &op, const Device &device)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
XprType::CoeffReturnType CoeffReturnType
A cost model used to limit the number of threads used for evaluating tensor expression.
TensorInflationOp< Strides, ArgType > XprType
array< Index, NumDims > m_inputStrides
const EIGEN_DEVICE_FUNC Strides & strides() const
array< internal::TensorIntDivisor< Index >, NumDims > m_fastStrides
array< Index, NumDims > m_outputStrides
traits< XprType > XprTraits
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
XprTraits::PointerType PointerType
Storage::Type EvaluatorPointerType
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:06:08