diff --git a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h index 547bb74d1..fdbe8df4c 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h @@ -79,6 +79,7 @@ class Tensor : public TensorBase > }; static const int Options = Options_; + static const std::size_t NumIndices = NumIndices_; typedef DSizes Dimensions; @@ -232,11 +233,9 @@ class Tensor : public TensorBase > 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 Assign; Assign assign(*this, other); + resize(TensorEvaluator(assign, DefaultDevice()).dimensions()); internal::TensorExecutor::run(assign, DefaultDevice()); return *this; } @@ -244,11 +243,9 @@ class Tensor : public TensorBase > EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor& operator=(const OtherDerived& 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 Assign; Assign assign(*this, other); + resize(TensorEvaluator(assign, DefaultDevice()).dimensions()); internal::TensorExecutor::run(assign, DefaultDevice()); return *this; }