Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ > Class Template Reference

The tensor class. More...

#include <Tensor.h>

+ Inheritance diagram for Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >:

Classes

struct  isOfNormalIndex
 

Public Types

enum  { IsAligned = (EIGEN_MAX_ALIGN_BYTES > 0) && !(Options_ & DontAlign) , CoordAccess = true , RawAccess = true }
 
typedef Tensor< Scalar_, NumIndices_, Options_, IndexType_ > Self
 
typedef TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > Base
 
typedef Eigen::internal::nested< Self >::type Nested
 
typedef internal::traits< Self >::StorageKind StorageKind
 
typedef internal::traits< Self >::Index Index
 
typedef Scalar_ Scalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef Base::CoeffReturnType CoeffReturnType
 
typedef DSizes< Index, NumIndices_ > Dimensions
 
- Public Types inherited from Eigen::TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > >
typedef TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ >, ReadOnlyAccessors > Base
 
typedef internal::traits< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > DerivedTraits
 
typedef DerivedTraits::Scalar Scalar
 
typedef DerivedTraits::Index Index
 
typedef Scalar CoeffReturnType
 

Public Member Functions

EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rank () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index dimension (std::size_t n) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensionsdimensions () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index size () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalardata ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalardata () const
 
Selfbase ()
 
const Selfbase () const
 
template<typename... IndexTypes>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalarcoeff (Index firstIndex, Index secondIndex, IndexTypes... otherIndices) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalarcoeff (const array< Index, NumIndices > &indices) const
 
template<typename CustomIndices , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomIndices >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalarcoeff (CustomIndices &indices) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalarcoeff () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalarcoeff (Index index) const
 
template<typename... IndexTypes>
ScalarcoeffRef (Index firstIndex, Index secondIndex, IndexTypes... otherIndices)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ScalarcoeffRef (const array< Index, NumIndices > &indices)
 
template<typename CustomIndices , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomIndices >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ScalarcoeffRef (CustomIndices &indices)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ScalarcoeffRef ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ScalarcoeffRef (Index index)
 
template<typename... IndexTypes>
const Scalaroperator() (Index firstIndex, Index secondIndex, IndexTypes... otherIndices) const
 
template<typename CustomIndices , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomIndices >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalaroperator() (CustomIndices &indices) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalaroperator() (const array< Index, NumIndices > &indices) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalaroperator() (Index index) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalaroperator() () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalaroperator[] (Index index) const
 
template<typename... IndexTypes>
Scalaroperator() (Index firstIndex, Index secondIndex, IndexTypes... otherIndices)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalaroperator() (const array< Index, NumIndices > &indices)
 
template<typename CustomIndices , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomIndices >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalaroperator() (CustomIndices &indices)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalaroperator() (Index index)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalaroperator() ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalaroperator[] (Index index)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor (const Self &other)
 
template<typename... IndexTypes>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor (Index firstDimension, IndexTypes... otherDimensions)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor (const array< Index, NumIndices > &dimensions)
 
template<typename OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor (const TensorBase< OtherDerived, ReadOnlyAccessors > &other)
 
template<typename OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor (const TensorBase< OtherDerived, WriteAccessors > &other)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor (Self &&other)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensoroperator= (Self &&other)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensoroperator= (const Tensor &other)
 
template<typename OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensoroperator= (const OtherDerived &other)
 
template<typename... IndexTypes>
EIGEN_DEVICE_FUNC void resize (Index firstDimension, IndexTypes... otherDimensions)
 
EIGEN_DEVICE_FUNC void resize (const array< Index, NumIndices > &dimensions)
 
EIGEN_DEVICE_FUNC void resize ()
 
template<typename FirstType , typename... OtherTypes>
EIGEN_DEVICE_FUNC void resize (const Eigen::IndexList< FirstType, OtherTypes... > &dimensions)
 
template<typename CustomDimension , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomDimension >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize (CustomDimension &dimensions)
 
template<typename std::ptrdiff_t... Indices>
EIGEN_DEVICE_FUNC void resize (const Sizes< Indices... > &dimensions)
 
- Public Member Functions inherited from Eigen::TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setZero ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setConstant (const Scalar &val)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setValues (const typename internal::Initializer< Tensor< Scalar_, NumIndices_, Options_, IndexType_ >, NumDimensions >::InitList &vals)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & operator+= (const OtherDerived &other)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & operator-= (const OtherDerived &other)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & operator*= (const OtherDerived &other)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & operator/= (const OtherDerived &other)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorLayoutSwapOp< const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > swap_layout () const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorLayoutSwapOp< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > swap_layout ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorConcatenationOp< const Axis, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ >, const OtherDerived > concatenate (const OtherDerived &other, const Axis &axis) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorConcatenationOp< const Axis, Tensor< Scalar_, NumIndices_, Options_, IndexType_ >, OtherDerived > concatenate (const OtherDerived &other, const Axis &axis)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorReshapingOp< const NewDimensions, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > reshape (const NewDimensions &newDimensions) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorReshapingOp< const NewDimensions, Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > reshape (const NewDimensions &newDimensions)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorSlicingOp< const StartIndices, const Sizes, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > slice (const StartIndices &startIndices, const Sizes &sizes) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorSlicingOp< const StartIndices, const Sizes, Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > slice (const StartIndices &startIndices, const Sizes &sizes)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorStridingSlicingOp< const StartIndices, const StopIndices, const Strides, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > stridedSlice (const StartIndices &startIndices, const StopIndices &stopIndices, const Strides &strides) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorStridingSlicingOp< const StartIndices, const StopIndices, const Strides, Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > stridedSlice (const StartIndices &startIndices, const StopIndices &stopIndices, const Strides &strides)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorChippingOp< DimId, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > chip (const Index offset) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorChippingOp< DimId, Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > chip (const Index offset)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorChippingOp< Dynamic, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > chip (const Index offset, const Index dim) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorChippingOp< Dynamic, Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > chip (const Index offset, const Index dim)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorReverseOp< const ReverseDimensions, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > reverse (const ReverseDimensions &rev) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorReverseOp< const ReverseDimensions, Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > reverse (const ReverseDimensions &rev)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorRollOp< const Rolls, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > roll (const Rolls &roll) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorRollOp< const Rolls, Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > roll (const Rolls &roll)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorShufflingOp< const Shuffle, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > shuffle (const Shuffle &shfl) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorShufflingOp< const Shuffle, Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > shuffle (const Shuffle &shfl)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorStridingOp< const Strides, const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > stride (const Strides &strides) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorStridingOp< const Strides, Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > stride (const Strides &strides)
 
TensorDevice< Tensor< Scalar_, NumIndices_, Options_, IndexType_ >, DeviceType > device (const DeviceType &dev)
 
TensorAsyncDevice< Tensor< Scalar_, NumIndices_, Options_, IndexType_ >, DeviceType, DoneCallback > device (const DeviceType &dev, DoneCallback done)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & derived ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & derived () const
 

Static Public Attributes

static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor
 
static constexpr int Options = Options_
 
static constexpr int NumIndices = NumIndices_
 
- Static Public Attributes inherited from Eigen::TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > >
static constexpr int NumDimensions
 

Protected Member Functions

bool checkIndexRange (const array< Index, NumIndices > &indices) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index linearizedIndex (const array< Index, NumIndices > &indices) const
 
- Protected Member Functions inherited from Eigen::TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & operator= (const OtherDerived &other)
 

Protected Attributes

TensorStorage< Scalar, Dimensions, Optionsm_storage
 

Detailed Description

template<typename Scalar_, int NumIndices_, int Options_, typename IndexType_>
class Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >

The tensor class.

The Tensor class is the work-horse for all dense tensors within Eigen.

The Tensor class encompasses only dynamic-size objects so far.

The first two template parameters are required:

Template Parameters
Scalar_Numeric type, e.g. float, double, int or std::complex<float>. User defined scalar types are supported as well (see here).
NumIndices_Number of indices (i.e. rank of the tensor)

The remaining template parameters are optional – in most cases you don't have to worry about them.

Template Parameters
Options_A combination of either RowMajor or ColMajor, and of either AutoAlign or DontAlign. The former controls storage order, and defaults to column-major. The latter controls alignment, which is required for vectorization. It defaults to aligning tensors. Note that tensors currently do not support any operations that profit from vectorization. Support for such operations (i.e. adding two tensors etc.) is planned.

You can access elements of tensors using normal subscripting:

Eigen::Tensor<double, 4> t(10, 10, 10, 10);
t(0, 1, 2, 3) = 42.0;
The tensor class.
Definition: Tensor.h:68
t
Definition: plotPSD.py:36

This class can be extended with the help of the plugin mechanism described on the page Extending MatrixBase (and other classes) by defining the preprocessor symbol EIGEN_TENSOR_PLUGIN, EIGEN_TENSORBASE_PLUGIN, and EIGEN_READONLY_TENSORBASE_PLUGIN.

Some notes:

Relation to other parts of Eigen:
The midterm development goal for this class is to have a similar hierarchy as Eigen uses for matrices, so that taking blocks or using tensors in expressions is easily possible, including an interface with the vector/matrix code by providing .asMatrix() and .asVector() (or similar) methods for rank 2 and 1 tensors. However, currently, the Tensor class does not provide any of these features and is only available as a stand-alone class that just allows for coefficient access. Also, when fixed-size tensors are implemented, the number of template arguments is likely to change dramatically.

TopicStorageOrders

Member Typedef Documentation

◆ Base

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
typedef TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexType_> > Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Base

◆ CoeffReturnType

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
typedef Base::CoeffReturnType Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::CoeffReturnType

◆ Dimensions

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
typedef DSizes<Index, NumIndices_> Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Dimensions

◆ Index

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
typedef internal::traits<Self>::Index Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Index

◆ Nested

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
typedef Eigen::internal::nested<Self>::type Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Nested

◆ RealScalar

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
typedef NumTraits<Scalar>::Real Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::RealScalar

◆ Scalar

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
typedef Scalar_ Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Scalar

◆ Self

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
typedef Tensor<Scalar_, NumIndices_, Options_, IndexType_> Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Self

◆ StorageKind

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
typedef internal::traits<Self>::StorageKind Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::StorageKind

Member Enumeration Documentation

◆ anonymous enum

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
anonymous enum
Enumerator
IsAligned 
CoordAccess 
RawAccess 
79 { IsAligned = (EIGEN_MAX_ALIGN_BYTES > 0) && !(Options_ & DontAlign), CoordAccess = true, RawAccess = true };
#define EIGEN_MAX_ALIGN_BYTES
Definition: ConfigureVectorization.h:163
@ CoordAccess
Definition: Tensor.h:79
@ IsAligned
Definition: Tensor.h:79
@ RawAccess
Definition: Tensor.h:79
@ DontAlign
Definition: Constants.h:324

Constructor & Destructor Documentation

◆ Tensor() [1/7]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Tensor ( )
inline
238 : m_storage() {}
TensorStorage< Scalar, Dimensions, Options > m_storage
Definition: Tensor.h:87

◆ Tensor() [2/7]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Tensor ( const Self other)
inline
240 : Base(other), m_storage(other.m_storage) {}
TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > > Base
Definition: Tensor.h:71

◆ Tensor() [3/7]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename... IndexTypes>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Tensor ( Index  firstDimension,
IndexTypes...  otherDimensions 
)
inline
244  : m_storage(firstDimension, otherDimensions...) {
245  // The number of dimensions used to construct a tensor must be equal to the rank of the tensor.
246  EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
247  }
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
static constexpr int NumIndices
Definition: Tensor.h:83

References EIGEN_STATIC_ASSERT, and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::NumIndices.

◆ Tensor() [4/7]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Tensor ( const array< Index, NumIndices > &  dimensions)
inlineexplicit

Normal Dimension

253  }
#define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
Definition: PlainObjectBase.h:24
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions & dimensions() const
Definition: Tensor.h:100
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE auto array_prod(const array< T, N > &arr) -> decltype(array_reduce< product_op, T, N >(arr, static_cast< T >(1)))
Definition: MoreMeta.h:497

References EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED.

◆ Tensor() [5/7]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Tensor ( const TensorBase< OtherDerived, ReadOnlyAccessors > &  other)
inline
256  {
257  EIGEN_STATIC_ASSERT(OtherDerived::NumDimensions == Base::NumDimensions, Number_of_dimensions_must_match)
258  typedef TensorAssignOp<Tensor, const OtherDerived> Assign;
259  Assign assign(*this, other.derived());
260  resize(TensorEvaluator<const Assign, DefaultDevice>(assign, DefaultDevice()).dimensions());
262  }
static constexpr int NumDimensions
Definition: TensorBase.h:1033
EIGEN_DEVICE_FUNC void resize()
Definition: Tensor.h:323
static EIGEN_STRONG_INLINE void run(const Expression &expr, const Device &device=DefaultDevice())
Definition: TensorExecutor.h:92

References Eigen::TensorBase< Derived, AccessLevel >::derived(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::dimensions(), EIGEN_STATIC_ASSERT, Eigen::TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > >::NumDimensions, Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize(), and Eigen::internal::TensorExecutor< Expression, Device, Vectorizable, Tiling >::run().

◆ Tensor() [6/7]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Tensor ( const TensorBase< OtherDerived, WriteAccessors > &  other)
inline
265  {
266  EIGEN_STATIC_ASSERT(OtherDerived::NumDimensions == Base::NumDimensions, Number_of_dimensions_must_match)
267  typedef TensorAssignOp<Tensor, const OtherDerived> Assign;
268  Assign assign(*this, other.derived());
269  resize(TensorEvaluator<const Assign, DefaultDevice>(assign, DefaultDevice()).dimensions());
271  }

References Eigen::TensorBase< Derived, AccessLevel >::derived(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::dimensions(), EIGEN_STATIC_ASSERT, Eigen::TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > >::NumDimensions, Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize(), and Eigen::internal::TensorExecutor< Expression, Device, Vectorizable, Tiling >::run().

◆ Tensor() [7/7]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Tensor ( Self &&  other)
inline
273 : m_storage(std::move(other.m_storage)) {}

Member Function Documentation

◆ base() [1/2]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
Self& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::base ( )
inline
108 { return *this; }

◆ base() [2/2]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
const Self& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::base ( ) const
inline
109 { return *this; }

◆ checkIndexRange()

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
bool Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::checkIndexRange ( const array< Index, NumIndices > &  indices) const
inlineprotected
357  {
360  using internal::greater_equal_zero_op;
361  using internal::lesser_op;
362  using internal::logical_and_op;
363 
364  return
365  // check whether the indices are all >= 0
366  array_apply_and_reduce<logical_and_op, greater_equal_zero_op>(indices) &&
367  // check whether the indices fit in the dimensions
368  array_zip_and_reduce<logical_and_op, lesser_op>(indices, m_storage.dimensions());
369  }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const FixedDimensions dimensions() const
Definition: TensorStorage.h:56
constexpr EIGEN_STRONG_INLINE auto array_zip_and_reduce(array< A, N > a, array< B, N > b) -> decltype(h_array_zip_and_reduce< Reducer, Op, A, B, N >(a, b, typename gen_numeric_list< int, N >::type()))
Definition: MoreMeta.h:536
constexpr EIGEN_STRONG_INLINE auto array_apply_and_reduce(array< A, N > a) -> decltype(h_array_apply_and_reduce< Reducer, Op, A, N >(a, typename gen_numeric_list< int, N >::type()))
Definition: MoreMeta.h:564

References Eigen::internal::array_apply_and_reduce(), Eigen::internal::array_zip_and_reduce(), Eigen::TensorStorage< T, FixedDimensions, Options_ >::dimensions(), and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::m_storage.

Referenced by Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff(), and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef().

◆ coeff() [1/5]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff ( ) const
inline

◆ coeff() [2/5]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff ( const array< Index, NumIndices > &  indices) const
inline
120  {
122  return m_storage.data()[linearizedIndex(indices)];
123  }
#define eigen_internal_assert(x)
Definition: Macros.h:916
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index linearizedIndex(const array< Index, NumIndices > &indices) const
Definition: Tensor.h:371
bool checkIndexRange(const array< Index, NumIndices > &indices) const
Definition: Tensor.h:357

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::checkIndexRange(), Eigen::TensorStorage< T, FixedDimensions, Options_ >::data(), eigen_internal_assert, Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::linearizedIndex(), and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::m_storage.

◆ coeff() [3/5]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename CustomIndices , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomIndices >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff ( CustomIndices &  indices) const
inline
127  {
128  return coeff(internal::customIndices2Array<Index, NumIndices>(indices));
129  }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff() const
Definition: Tensor.h:131

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff().

◆ coeff() [4/5]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename... IndexTypes>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff ( Index  firstIndex,
Index  secondIndex,
IndexTypes...  otherIndices 
) const
inline

◆ coeff() [5/5]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff ( Index  index) const
inline

◆ coeffRef() [1/5]

◆ coeffRef() [2/5]

◆ coeffRef() [3/5]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename CustomIndices , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomIndices >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef ( CustomIndices &  indices)
inline
156  {
157  return coeffRef(internal::customIndices2Array<Index, NumIndices>(indices));
158  }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef()
Definition: Tensor.h:160

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef().

◆ coeffRef() [4/5]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename... IndexTypes>
Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef ( Index  firstIndex,
Index  secondIndex,
IndexTypes...  otherIndices 
)
inline
142  {
143  // The number of indices used to access a tensor coefficient must be equal to the rank of the tensor.
144  EIGEN_STATIC_ASSERT(sizeof...(otherIndices) + 2 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
145  return coeffRef(array<Index, NumIndices>{{firstIndex, secondIndex, otherIndices...}});
146  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef(), EIGEN_STATIC_ASSERT, and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::NumIndices.

Referenced by test_map_as_index(), test_matrix_as_index(), test_sizes_as_index(), and test_varlist_as_index().

◆ coeffRef() [5/5]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef ( Index  index)
inline

◆ data() [1/2]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar* Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::data ( )
inline
102 { return m_storage.data(); }

References Eigen::TensorStorage< T, FixedDimensions, Options_ >::data(), and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::m_storage.

Referenced by gdb.printers.EigenMatrixPrinter::children(), gdb.printers.EigenSparseMatrixPrinter::children(), gdb.printers.EigenQuaternionPrinter::children(), contraction_both_transposed(), contraction_lhs_transposed(), contraction_rhs_transposed(), main(), Eigen::internal::TensorPrinter< Tensor, rank, TensorIOFormatLegacy, std::enable_if_t< rank !=0 > >::run(), Eigen::internal::TensorPrinter< Tensor, rank, Format, EnableIf >::run(), test_0d(), test_0d_const_tensor_map(), test_1d(), test_1D_sycl(), test_2d(), test_2D_sycl(), test_3d(), test_argmax_dim(), test_argmin_dim(), test_assign_of_const_tensor(), test_assign_to_tensor(), test_assign_to_tensor_chipping(), test_assign_to_tensor_reshape(), test_assign_to_tensor_shuffle(), test_assign_to_tensor_slice(), test_async_multithread_contraction_agrees_with_singlethread(), test_async_multithread_volume_patch(), test_async_sharded_by_inner_dim_contraction(), test_async_sharded_by_inner_dim_contraction_with_output_kernel(), test_binary_builtins_fixed_arg2(), test_binary_builtins_func(), test_block_io_copy_data_from_source_to_target(), test_block_io_copy_using_reordered_dimensions(), test_block_io_copy_using_reordered_dimensions_do_not_squeeze(), test_block_io_copy_using_reordered_dimensions_squeeze(), test_block_io_squeeze_ones(), test_block_io_zero_stride(), test_boolean(), test_broadcast_sycl(), test_broadcast_sycl_fixed(), test_chip_as_lvalue_sycl(), test_chip_in_expr(), test_concatenation_as_lvalue(), test_consistency(), test_const_inputs(), test_contraction_corner_cases(), test_contraction_of_contraction(), test_contractions(), test_custom_binary_op_sycl(), test_custom_unary_op_sycl(), test_device_memory(), test_dynamic_chip_sycl(), test_entire_volume_patch_sycl(), test_evals(), test_expr(), test_expr_reverse(), test_first_dim_reductions_max_sycl(), test_first_dim_reductions_mean_sycl(), test_first_dim_reductions_sum_sycl(), test_forced_eval_sycl(), test_full_reductions_max_sycl(), test_full_reductions_mean_sycl(), test_full_reductions_min_sycl(), test_full_reductions_sum_sycl(), test_gaussian_sycl(), test_gpu_contractions(), test_gpu_elementwise(), test_gpu_forced_evals(), test_gpu_full_reductions(), test_gpu_numext(), test_gpu_reductions(), test_gpu_trancendental(), test_gpu_unary(), test_image_op_sycl(), test_imagenet_patches_sycl(), test_larg_expr1D(), test_larg_expr2D(), test_larg_expr3D(), test_large_contraction(), test_large_contraction_with_output_kernel(), test_last_dim_reductions_mean_sycl(), test_last_dim_reductions_sum_sycl(), test_matrix_vector(), test_memcpy(), test_modes(), test_multidims(), test_multiple_dims(), test_multithread_contraction(), test_multithread_contraction_agrees_with_singlethread(), test_multithread_contraction_with_output_kernel(), test_multithread_volume_patch(), test_no_out_of_bounds(), test_padded_expr(), test_patch_no_extra_dim(), test_patch_no_extra_dim_sycl(), test_patch_padding_same(), test_patch_padding_same_negative_padding_clip_to_zero(), test_patch_padding_same_sycl(), test_patch_padding_valid(), test_patch_padding_valid_same_value_sycl(), test_patch_padding_valid_sycl(), test_ref_of_ref(), test_reshape_as_lvalue(), test_reshape_in_expr(), test_same_type(), test_scalar(), test_sharded_by_inner_dim_contraction(), test_sharded_by_inner_dim_contraction_with_output_kernel(), test_sigmoid_sycl(), test_simple_assign(), test_simple_concatenation(), test_simple_image_patch_sycl(), test_simple_inflation_sycl(), test_simple_lvalue_ref(), test_simple_padding(), test_simple_patch(), test_simple_patch_sycl(), test_simple_reductions(), test_simple_reshape(), test_simple_reverse(), test_simple_rvalue_ref(), test_simple_shuffling_sycl(), test_simple_slice(), test_simple_striding(), test_simple_swap_sycl(), test_single_voxel_patch(), test_single_voxel_patch_sycl(), test_slice(), test_slice_in_expr(), test_slice_raw_data(), test_small_blocking_factors(), test_static_chip_sycl(), test_strided_slice_as_rhs_sycl(), test_strided_slice_write_sycl(), test_strides(), test_striding_as_lvalue(), test_swap_as_lvalue_sycl(), test_sycl_argmax_dim(), test_sycl_argmin_dim(), test_sycl_cast(), test_sycl_computations(), test_sycl_contraction(), test_sycl_cumsum(), test_sycl_mem_sync(), test_sycl_mem_transfers(), test_sycl_simple_argmax(), test_tanh_sycl(), test_tensor_vector(), test_unary_builtins_for_scalar(), test_unary_builtins_return_bool(), gdb.printers.EigenMatrixPrinter::to_string(), gdb.printers.EigenSparseMatrixPrinter::to_string(), gdb.printers.EigenQuaternionPrinter::to_string(), and VerifyBlockEvaluator().

◆ data() [2/2]

◆ dimension()

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::dimension ( std::size_t  n) const
inline
99 { return m_storage.dimensions()[n]; }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11

References Eigen::TensorStorage< T, FixedDimensions, Options_ >::dimensions(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::m_storage, and n.

Referenced by InsertZeros< TensorType >::dimensions(), BatchMatMul< TensorType >::dimensions(), test_1D_fft_ifft_invariant(), test_1d_scan(), test_2D_fft_ifft_invariant(), test_3D_fft_ifft_invariant(), test_argmax_dim(), test_argmin_dim(), test_auto_resize(), test_composition(), test_concat(), test_contraction_of_contraction(), test_custom_unary_op(), test_dynamic_chip(), test_dynamic_chip_sycl(), test_empty_shuffling(), test_entire_volume_patch(), test_entire_volume_patch_sycl(), test_expr_reverse(), test_expr_roll(), test_expr_shuffling(), test_fft_complex_input_golden(), test_fft_real_input_energy(), test_fft_real_input_golden(), test_full_redux(), test_holes(), test_imagenet_patches(), test_imagenet_patches_sycl(), test_modes(), test_nested_ops_with_ref(), test_patch_no_extra_dim(), test_patch_no_extra_dim_sycl(), test_patch_padding_same(), test_patch_padding_same_negative_padding_clip_to_zero(), test_patch_padding_same_sycl(), test_patch_padding_valid(), test_patch_padding_valid_same_value(), test_patch_padding_valid_same_value_sycl(), test_patch_padding_valid_sycl(), test_reductions_in_expr(), test_simple_broadcasting(), test_simple_broadcasting_n_by_one(), test_simple_broadcasting_one_by_n(), test_simple_broadcasting_one_by_n_by_one_1d(), test_simple_broadcasting_one_by_n_by_one_2d(), test_simple_chip(), test_simple_concatenation(), test_simple_image_patch_sycl(), test_simple_inflation(), test_simple_inflation_sycl(), test_simple_padding(), test_simple_patch(), test_simple_patch_sycl(), test_simple_reductions(), test_simple_reverse(), test_simple_roll(), test_simple_shuffling(), test_simple_shuffling_sycl(), test_simple_striding(), test_simple_swap(), test_simple_swap_sycl(), test_simple_trace(), test_single_voxel_patch(), test_single_voxel_patch_sycl(), test_size_one_broadcasting(), test_static_broadcasting(), test_static_chip_sycl(), test_strides(), test_sub_fft_ifft_invariant(), test_swap_as_lvalue(), test_swap_as_lvalue_sycl(), test_sycl_argmax_dim(), test_sycl_argmin_dim(), test_tensor_product(), test_trace_in_expr(), test_trivial_reductions(), test_user_defined_reductions(), and test_vectorized_broadcasting().

◆ dimensions()

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::dimensions ( ) const
inline
100 { return m_storage.dimensions(); }

References Eigen::TensorStorage< T, FixedDimensions, Options_ >::dimensions(), and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::m_storage.

Referenced by Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator=(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize(), Eigen::internal::TensorPrinter< Tensor, rank, TensorIOFormatLegacy, std::enable_if_t< rank !=0 > >::run(), Eigen::internal::TensorPrinter< Tensor, rank, Format, EnableIf >::run(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Tensor(), test_2d(), test_3d(), test_async_execute_binary_expr(), test_async_execute_unary_expr(), test_async_multithread_contraction_agrees_with_singlethread(), test_async_sharded_by_inner_dim_contraction(), test_async_sharded_by_inner_dim_contraction_with_output_kernel(), test_broadcast_sycl(), test_broadcast_sycl_fixed(), test_composition(), test_concatenation_as_lvalue(), test_contractions(), test_custom_binary_op_sycl(), test_custom_unary_op_sycl(), test_execute_binary_expr(), test_execute_broadcasting(), test_execute_broadcasting_of_forced_eval(), test_execute_generator_op(), test_execute_reshape(), test_execute_reverse_rvalue(), test_execute_shuffle_lvalue(), test_execute_shuffle_rvalue(), test_execute_slice_lvalue(), test_execute_slice_rvalue(), test_execute_unary_expr(), test_expr_reverse(), test_expr_roll(), test_first_dim_reductions_max_sycl(), test_first_dim_reductions_mean_sycl(), test_first_dim_reductions_sum_sycl(), test_forced_eval_sycl(), test_full_contraction(), test_full_reductions_max_sycl(), test_full_reductions_mean_sycl(), test_full_reductions_min_sycl(), test_full_reductions_sum_sycl(), test_large_contraction(), test_large_contraction_with_output_kernel(), test_last_dim_reductions_mean_sycl(), test_last_dim_reductions_sum_sycl(), test_matrix_vector(), test_modes(), test_multithread_contraction_agrees_with_singlethread(), test_multithread_contraction_with_output_kernel(), test_sharded_by_inner_dim_contraction(), test_sharded_by_inner_dim_contraction_with_output_kernel(), test_simple_concatenation(), test_simple_reverse(), test_small_blocking_factors(), test_strides(), test_tensor_vector(), VerifyBlockAssignment(), and VerifyBlockEvaluator().

◆ linearizedIndex()

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::linearizedIndex ( const array< Index, NumIndices > &  indices) const
inlineprotected
371  {
372  if (Options & RowMajor) {
373  return m_storage.dimensions().IndexOfRowMajor(indices);
374  } else {
375  return m_storage.dimensions().IndexOfColMajor(indices);
376  }
377  }
static constexpr int Options
Definition: Tensor.h:82
@ RowMajor
Definition: Constants.h:320
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex IndexOfColMajor(const array< DenseIndex, NumDims > &indices) const
Definition: TensorDimensions.h:230
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex IndexOfRowMajor(const array< DenseIndex, NumDims > &indices) const
Definition: TensorDimensions.h:234

References Eigen::TensorStorage< T, FixedDimensions, Options_ >::dimensions(), Eigen::DSizes< DenseIndex, NumDims >::IndexOfColMajor(), Eigen::DSizes< DenseIndex, NumDims >::IndexOfRowMajor(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::m_storage, Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Options, and Eigen::RowMajor.

Referenced by Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff(), and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef().

◆ operator()() [1/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( )
inline

◆ operator()() [2/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( ) const
inline

◆ operator()() [3/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( const array< Index, NumIndices > &  indices)
inline
212  {
213  return coeffRef(indices);
214  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef().

◆ operator()() [4/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( const array< Index, NumIndices > &  indices) const
inline
184  {
185  return coeff(indices);
186  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff().

◆ operator()() [5/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename CustomIndices , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomIndices >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( CustomIndices &  indices)
inline
218  {
219  return coeffRef(internal::customIndices2Array<Index, NumIndices>(indices));
220  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef().

◆ operator()() [6/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename CustomIndices , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomIndices >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( CustomIndices &  indices) const
inline
179  {
180  return coeff(internal::customIndices2Array<Index, NumIndices>(indices));
181  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff().

◆ operator()() [7/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename... IndexTypes>
Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( Index  firstIndex,
Index  secondIndex,
IndexTypes...  otherIndices 
)
inline
205  {
206  // The number of indices used to access a tensor coefficient must be equal to the rank of the tensor.
207  EIGEN_STATIC_ASSERT(sizeof...(otherIndices) + 2 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
208  return operator()(array<Index, NumIndices>{{firstIndex, secondIndex, otherIndices...}});
209  }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & operator()() const
Definition: Tensor.h:193

References EIGEN_STATIC_ASSERT, Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::NumIndices, and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator()().

◆ operator()() [8/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename... IndexTypes>
const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( Index  firstIndex,
Index  secondIndex,
IndexTypes...  otherIndices 
) const
inline
171  {
172  // The number of indices used to access a tensor coefficient must be equal to the rank of the tensor.
173  EIGEN_STATIC_ASSERT(sizeof...(otherIndices) + 2 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
174  return this->operator()(array<Index, NumIndices>{{firstIndex, secondIndex, otherIndices...}});
175  }

References EIGEN_STATIC_ASSERT, Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::NumIndices, and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator()().

◆ operator()() [9/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( Index  index)
inline
222  {
223  eigen_assert(index >= 0 && index < size());
224  return coeffRef(index);
225  }
#define eigen_assert(x)
Definition: Macros.h:910

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef(), eigen_assert, and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::size().

◆ operator()() [10/10]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator() ( Index  index) const
inline

◆ operator=() [1/3]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator= ( const OtherDerived &  other)
inline
287  {
288  typedef TensorAssignOp<Tensor, const OtherDerived> Assign;
289  Assign assign(*this, other);
290  resize(TensorEvaluator<const Assign, DefaultDevice>(assign, DefaultDevice()).dimensions());
292  return *this;
293  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::dimensions(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize(), and Eigen::internal::TensorExecutor< Expression, Device, Vectorizable, Tiling >::run().

◆ operator=() [2/3]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator= ( const Tensor< Scalar_, NumIndices_, Options_, IndexType_ > &  other)
inline
279  {
280  typedef TensorAssignOp<Tensor, const Tensor> Assign;
281  Assign assign(*this, other);
282  resize(TensorEvaluator<const Assign, DefaultDevice>(assign, DefaultDevice()).dimensions());
284  return *this;
285  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::dimensions(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize(), and Eigen::internal::TensorExecutor< Expression, Device, Vectorizable, Tiling >::run().

◆ operator=() [3/3]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator= ( Self &&  other)
inline
274  {
275  m_storage = std::move(other.m_storage);
276  return *this;
277  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::m_storage.

◆ operator[]() [1/2]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator[] ( Index  index)
inline
232  {
233  // The bracket operator is only for vectors, use the parenthesis operator instead
234  EIGEN_STATIC_ASSERT(NumIndices == 1, YOU_MADE_A_PROGRAMMING_MISTAKE)
235  return coeffRef(index);
236  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef(), EIGEN_STATIC_ASSERT, and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::NumIndices.

◆ operator[]() [2/2]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator[] ( Index  index) const
inline
198  {
199  // The bracket operator is only for vectors, use the parenthesis operator instead.
200  EIGEN_STATIC_ASSERT(NumIndices == 1, YOU_MADE_A_PROGRAMMING_MISTAKE);
201  return coeff(index);
202  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff(), EIGEN_STATIC_ASSERT, and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::NumIndices.

◆ rank()

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::rank ( ) const
inline

◆ resize() [1/6]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC void Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize ( )
inline

◆ resize() [2/6]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC void Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize ( const array< Index, NumIndices > &  dimensions)
inline

Normal Dimension

303  {
304 #ifndef EIGEN_NO_DEBUG
305  Index size = Index(1);
306  for (int i = 0; i < NumIndices; i++) {
308  size *= dimensions[i];
309  }
310 #else
312 #endif
313 
314 #ifdef EIGEN_INITIALIZE_COEFFS
315  bool size_changed = size != this->size();
316  m_storage.resize(size, dimensions);
318 #else
319  m_storage.resize(size, dimensions);
320 #endif
321  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
internal::traits< Self >::Index Index
Definition: Tensor.h:74
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317

References Eigen::internal::array_prod(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::dimensions(), EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED, i, Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::m_storage, Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::NumIndices, run(), and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::size().

◆ resize() [3/6]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename FirstType , typename... OtherTypes>
EIGEN_DEVICE_FUNC void Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize ( const Eigen::IndexList< FirstType, OtherTypes... > &  dimensions)
inline

◆ resize() [4/6]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename std::ptrdiff_t... Indices>
EIGEN_DEVICE_FUNC void Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize ( const Sizes< Indices... > &  dimensions)
inline

◆ resize() [5/6]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename CustomDimension , EIGEN_SFINAE_ENABLE_IF(!(isOfNormalIndex< CustomDimension >::value)) >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize ( CustomDimension &  dimensions)
inline

Custom Dimension

339  {
340  resize(internal::customIndices2Array<Index, NumIndices>(dimensions));
341  }

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::dimensions(), and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize().

◆ resize() [6/6]

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
template<typename... IndexTypes>
EIGEN_DEVICE_FUNC void Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize ( Index  firstDimension,
IndexTypes...  otherDimensions 
)
inline
296  {
297  // The number of dimensions used to resize a tensor must be equal to the rank of the tensor.
298  EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
299  resize(array<Index, NumIndices>{{firstDimension, otherDimensions...}});
300  }

References EIGEN_STATIC_ASSERT, Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::NumIndices, and Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize().

Referenced by test_0d(), test_1d(), test_contraction_corner_cases(), test_fft_non_power_of_2_round_trip(), test_fft_real_input_energy(), test_imagenet_patches(), test_imagenet_patches_sycl(), test_static_broadcasting(), and test_vectorized_broadcasting().

◆ size()

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::size ( ) const
inline
101 { return m_storage.size(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex size() const
Definition: TensorStorage.h:58

References Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::m_storage, and Eigen::TensorStorage< T, FixedDimensions, Options_ >::size().

Referenced by Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeff(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::coeffRef(), contraction_both_transposed(), contraction_lhs_transposed(), contraction_rhs_transposed(), main(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::operator()(), Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::resize(), test_0d(), test_0d_const_tensor(), test_1D_sycl(), test_2d(), test_3d(), test_argmax_dim(), test_argmin_dim(), test_async_multithread_contraction_agrees_with_singlethread(), test_async_multithread_volume_patch(), test_binary_builtins_fixed_arg2(), test_binary_builtins_func(), test_broadcast_sycl(), test_broadcast_sycl_fixed(), test_chip_as_lvalue_sycl(), test_chip_in_expr(), test_contraction_corner_cases(), test_device_memory(), test_dynamic_chip_sycl(), test_dynamic_index_list(), test_entire_volume_patch_sycl(), test_evals(), test_expr(), test_first_dim_reductions_sum_sycl(), test_image_op_sycl(), test_imagenet_patches_sycl(), test_index_pairs_dim(), test_larg_expr1D(), test_larg_expr2D(), test_larg_expr3D(), test_modes(), test_move(), test_multithread_contraction(), test_multithread_contraction_agrees_with_singlethread(), test_multithread_volume_patch(), test_no_out_of_bounds(), test_padded_expr(), test_patch_no_extra_dim(), test_patch_no_extra_dim_sycl(), test_patch_padding_same(), test_patch_padding_same_negative_padding_clip_to_zero(), test_patch_padding_same_sycl(), test_patch_padding_valid(), test_patch_padding_valid_same_value_sycl(), test_patch_padding_valid_sycl(), test_reshape_as_lvalue(), test_scalar(), test_sigmoid_sycl(), test_simple_image_patch_sycl(), test_simple_inflation_sycl(), test_simple_padding(), test_simple_patch(), test_simple_patch_sycl(), test_simple_reshape(), test_simple_shuffling_sycl(), test_simple_slice(), test_simple_striding(), test_simple_swap_sycl(), test_single_voxel_patch(), test_single_voxel_patch_sycl(), test_static_chip_sycl(), test_static_index_list(), test_strided_slice_as_rhs_sycl(), test_strided_slice_write_sycl(), test_strides(), test_striding_as_lvalue(), test_swap_as_lvalue_sycl(), test_sycl_argmax_dim(), test_sycl_argmin_dim(), test_sycl_cast(), test_sycl_computations(), test_sycl_contraction(), test_sycl_cumsum(), test_sycl_mem_sync(), test_sycl_mem_transfers(), test_sycl_simple_argmax(), test_tanh_sycl(), test_unary_builtins_for_scalar(), and test_unary_builtins_return_bool().

Member Data Documentation

◆ Layout

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
constexpr int Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Layout = Options_ & RowMajor ? RowMajor : ColMajor
staticconstexpr

◆ m_storage

◆ NumIndices

◆ Options

template<typename Scalar_ , int NumIndices_, int Options_, typename IndexType_ >
constexpr int Eigen::Tensor< Scalar_, NumIndices_, Options_, IndexType_ >::Options = Options_
staticconstexpr

The documentation for this class was generated from the following file: