10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_ASSIGN_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_ASSIGN_H 24 template<
typename LhsXprType,
typename RhsXprType>
44 template<
typename LhsXprType,
typename RhsXprType>
50 template<
typename LhsXprType,
typename RhsXprType>
60 template<
typename LhsXprType,
typename RhsXprType>
74 : m_lhs_xpr(lhs), m_rhs_xpr(rhs) {}
91 template<
typename LeftArgType,
typename RightArgType,
typename Device>
104 static const int NumDims = XprType::NumDims;
128 m_leftImpl(op.lhsExpression(), device),
129 m_rightImpl(op.rhsExpression(), device)
134 YOU_MADE_A_PROGRAMMING_MISTAKE);
142 return m_rightImpl.dimensions();
147 m_leftImpl.evalSubExprsIfNeeded(
NULL);
152 return m_rightImpl.evalSubExprsIfNeeded(m_leftImpl.data());
155 #ifdef EIGEN_USE_THREADS 156 template <
typename EvalSubExprsCallback>
158 EvaluatorPointerType, EvalSubExprsCallback done) {
159 m_leftImpl.evalSubExprsIfNeededAsync(
nullptr, [
this, done](
bool) {
160 m_rightImpl.evalSubExprsIfNeededAsync(
161 m_leftImpl.data(), [done](
bool need_assign) { done(need_assign); });
164 #endif // EIGEN_USE_THREADS 167 m_leftImpl.cleanup();
168 m_rightImpl.cleanup();
172 m_leftImpl.coeffRef(i) = m_rightImpl.coeff(i);
178 m_leftImpl.template writePacket<LhsStoreMode>(
i, m_rightImpl.template packet<RhsLoadMode>(
i));
182 return m_leftImpl.coeff(index);
184 template<
int LoadMode>
187 return m_leftImpl.template packet<LoadMode>(index);
196 return m_rightImpl.costPerCoeff(vectorized) +
200 TensorOpCost(0,
sizeof(CoeffReturnType), 0, vectorized, PacketSize);
206 m_leftImpl.getResourceRequirements(),
207 m_rightImpl.getResourceRequirements());
211 TensorBlockDesc& desc, TensorBlockScratch& scratch) {
216 desc.template AddDestinationBuffer<Layout>(
217 m_leftImpl.data() + desc.
offset(),
218 internal::strides<Layout>(m_leftImpl.dimensions()));
224 m_leftImpl.writeBlock(desc, block);
229 #ifdef EIGEN_USE_SYCL 232 m_leftImpl.bind(cgh);
233 m_rightImpl.bind(cgh);
247 #endif // EIGEN_CXX11_TENSOR_TENSOR_ASSIGN_H LhsXprType::CoeffReturnType CoeffReturnType
TensorAssignOp< LhsXprType, RhsXprType > type
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC internal::remove_all< typename LhsXprType::Nested >::type & lhsExpression() const
TensorEvaluator< RightArgType, Device >::Dimensions Dimensions
m m block(1, 0, 2, 2)<< 4
Storage::Type EvaluatorPointerType
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
Eigen::NumTraits< Scalar >::Real RealScalar
const TensorAssignOp< LhsXprType, RhsXprType > & type
internal::TensorBlockScratchAllocator< Device > TensorBlockScratch
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double compute_cycles() const
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool dimensions_match(Dims1 dims1, Dims2 dims2)
Namespace containing all symbols from the Eigen library.
remove_reference< LhsNested >::type _LhsNested
TensorEvaluator< LeftArgType, Device > m_leftImpl
A cost model used to limit the number of threads used for evaluating tensor expression.
traits< LhsXprType >::PointerType PointerType
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
Eigen::internal::nested< TensorAssignOp >::type Nested
EIGEN_DEVICE_FUNC const internal::remove_all< typename RhsXprType::Nested >::type & rhsExpression() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::TensorBlockResourceRequirements getResourceRequirements() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_stored() const
remove_reference< RhsNested >::type _RhsNested
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorAssignOp(LhsXprType &lhs, const RhsXprType &rhs)
XprType::CoeffReturnType CoeffReturnType
Eigen::internal::traits< TensorAssignOp >::StorageKind StorageKind
internal::remove_all< typename LhsXprType::Nested >::type & m_lhs_xpr
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const
const internal::remove_all< typename RhsXprType::Nested >::type & m_rhs_xpr
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType)
TensorBlockKind kind() const
LhsXprType::Scalar Scalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double bytes_loaded() const
TensorEvaluator< const RightArgType, Device >::TensorBlock RightTensorBlock
promote_index_type< typename traits< LhsXprType >::Index, typename traits< RhsXprType >::Index >::type Index
TensorAssignOp< LeftArgType, RightArgType > XprType
EIGEN_DEVICE_FUNC EvaluatorPointerType data() const
#define EIGEN_DEVICE_FUNC
Eigen::internal::traits< TensorAssignOp >::Index Index
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalBlock(TensorBlockDesc &desc, TensorBlockScratch &scratch)
internal::TensorBlockDescriptor< NumDims, Index > TensorBlockDesc
EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const
TensorEvaluator< RightArgType, Device > m_rightImpl
PacketType< CoeffReturnType, Device >::type PacketReturnType
StorageMemory< CoeffReturnType, Device > Storage
traits< LhsXprType >::StorageKind StorageKind
LhsXprType::Nested LhsNested
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const
Eigen::internal::traits< TensorAssignOp >::Scalar Scalar
Generic expression where a coefficient-wise unary operator is applied to an expression.
TensorEvaluator(const XprType &op, const Device &device)
RhsXprType::Nested RhsNested
EIGEN_DEVICE_FUNC const Dimensions & dimensions() const
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorBlockResourceRequirements merge(const TensorBlockResourceRequirements &lhs, const TensorBlockResourceRequirements &rhs)
EIGEN_STRONG_INLINE void cleanup()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalPacket(Index i)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalScalar(Index i)