mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-29 23:34:12 +08:00
Fixed the assignment operator of the Tensor and TensorMap classes.
This commit is contained in:
parent
40bb98e76a
commit
f7bb7ee3f3
@ -229,6 +229,17 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_> >
|
|||||||
EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
EIGEN_STRONG_INLINE Tensor& operator=(const Tensor& other)
|
||||||
|
{
|
||||||
|
// FIXME: we need to resize the tensor to fix the dimensions of the other.
|
||||||
|
// Unfortunately this isn't possible yet when the rhs is an expression.
|
||||||
|
// resize(other.dimensions());
|
||||||
|
typedef TensorAssignOp<Tensor, const Tensor> Assign;
|
||||||
|
Assign assign(*this, other);
|
||||||
|
internal::TensorExecutor<const Assign, DefaultDevice>::run(assign, DefaultDevice());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE Tensor& operator=(const OtherDerived& other)
|
EIGEN_STRONG_INLINE Tensor& operator=(const OtherDerived& other)
|
||||||
|
@ -241,9 +241,16 @@ template<typename PlainObjectType, int Options_> class TensorMap : public Tensor
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self& operator=(const Self& other)
|
||||||
|
{
|
||||||
|
typedef TensorAssignOp<Self, const Self> Assign;
|
||||||
|
Assign assign(*this, other);
|
||||||
|
internal::TensorExecutor<const Assign, DefaultDevice>::run(assign, DefaultDevice());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||||
Self& operator=(const OtherDerived& other)
|
Self& operator=(const OtherDerived& other)
|
||||||
{
|
{
|
||||||
typedef TensorAssignOp<Self, const OtherDerived> Assign;
|
typedef TensorAssignOp<Self, const OtherDerived> Assign;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user