mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-06 14:14:46 +08:00
Deleted redundant code
This commit is contained in:
parent
c41e9e4bd0
commit
029052d276
@ -63,92 +63,6 @@ template <typename ExpressionType, typename DeviceType> class TensorDevice {
|
|||||||
ExpressionType& m_expression;
|
ExpressionType& m_expression;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef EIGEN_USE_THREADS
|
|
||||||
template <typename ExpressionType> class TensorDevice<ExpressionType, ThreadPoolDevice> {
|
|
||||||
public:
|
|
||||||
TensorDevice(const ThreadPoolDevice& device, ExpressionType& expression) : m_device(device), m_expression(expression) {}
|
|
||||||
|
|
||||||
template<typename OtherDerived>
|
|
||||||
EIGEN_STRONG_INLINE TensorDevice& operator=(const OtherDerived& other) {
|
|
||||||
typedef TensorAssignOp<ExpressionType, const OtherDerived> Assign;
|
|
||||||
Assign assign(m_expression, other);
|
|
||||||
internal::TensorExecutor<const Assign, ThreadPoolDevice>::run(assign, m_device);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename OtherDerived>
|
|
||||||
EIGEN_STRONG_INLINE TensorDevice& operator+=(const OtherDerived& other) {
|
|
||||||
typedef typename OtherDerived::Scalar Scalar;
|
|
||||||
typedef TensorCwiseBinaryOp<internal::scalar_sum_op<Scalar>, const ExpressionType, const OtherDerived> Sum;
|
|
||||||
Sum sum(m_expression, other);
|
|
||||||
typedef TensorAssignOp<ExpressionType, const Sum> Assign;
|
|
||||||
Assign assign(m_expression, sum);
|
|
||||||
internal::TensorExecutor<const Assign, ThreadPoolDevice>::run(assign, m_device);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename OtherDerived>
|
|
||||||
EIGEN_STRONG_INLINE TensorDevice& operator-=(const OtherDerived& other) {
|
|
||||||
typedef typename OtherDerived::Scalar Scalar;
|
|
||||||
typedef TensorCwiseBinaryOp<internal::scalar_difference_op<Scalar>, const ExpressionType, const OtherDerived> Difference;
|
|
||||||
Difference difference(m_expression, other);
|
|
||||||
typedef TensorAssignOp<ExpressionType, const Difference> Assign;
|
|
||||||
Assign assign(m_expression, difference);
|
|
||||||
internal::TensorExecutor<const Assign, ThreadPoolDevice>::run(assign, m_device);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const ThreadPoolDevice& m_device;
|
|
||||||
ExpressionType& m_expression;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(EIGEN_USE_GPU)
|
|
||||||
template <typename ExpressionType> class TensorDevice<ExpressionType, GpuDevice>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TensorDevice(const GpuDevice& device, ExpressionType& expression) : m_device(device), m_expression(expression) {}
|
|
||||||
|
|
||||||
template<typename OtherDerived>
|
|
||||||
EIGEN_STRONG_INLINE TensorDevice& operator=(const OtherDerived& other) {
|
|
||||||
typedef TensorAssignOp<ExpressionType, const OtherDerived> Assign;
|
|
||||||
Assign assign(m_expression, other);
|
|
||||||
internal::TensorExecutor<const Assign, GpuDevice>::run(assign, m_device);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename OtherDerived>
|
|
||||||
EIGEN_STRONG_INLINE TensorDevice& operator+=(const OtherDerived& other) {
|
|
||||||
typedef typename OtherDerived::Scalar Scalar;
|
|
||||||
typedef TensorCwiseBinaryOp<internal::scalar_sum_op<Scalar>, const ExpressionType, const OtherDerived> Sum;
|
|
||||||
Sum sum(m_expression, other);
|
|
||||||
typedef TensorAssignOp<ExpressionType, const Sum> Assign;
|
|
||||||
Assign assign(m_expression, sum);
|
|
||||||
internal::TensorExecutor<const Assign, GpuDevice>::run(assign, m_device);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename OtherDerived>
|
|
||||||
EIGEN_STRONG_INLINE TensorDevice& operator-=(const OtherDerived& other) {
|
|
||||||
typedef typename OtherDerived::Scalar Scalar;
|
|
||||||
typedef TensorCwiseBinaryOp<internal::scalar_difference_op<Scalar>, const ExpressionType, const OtherDerived> Difference;
|
|
||||||
Difference difference(m_expression, other);
|
|
||||||
typedef TensorAssignOp<ExpressionType, const Difference> Assign;
|
|
||||||
Assign assign(m_expression, difference);
|
|
||||||
internal::TensorExecutor<const Assign, GpuDevice>::run(assign, m_device);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const GpuDevice& m_device;
|
|
||||||
ExpressionType& m_expression;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
|
#endif // EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
|
||||||
|
Loading…
Reference in New Issue
Block a user