10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
13 #include "./InternalHeaderCheck.h"
29 template <
typename ExpressionType,
typename DeviceType>
class TensorDevice {
31 TensorDevice(
const DeviceType& device, ExpressionType& expression) : m_device(device), m_expression(expression) {}
35 template<
typename OtherDerived>
36 EIGEN_STRONG_INLINE
TensorDevice& operator=(
const OtherDerived& other) {
37 typedef TensorAssignOp<ExpressionType, const OtherDerived> Assign;
38 Assign assign(m_expression, other);
39 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
43 template<
typename OtherDerived>
44 EIGEN_STRONG_INLINE
TensorDevice& operator+=(
const OtherDerived& other) {
45 typedef typename OtherDerived::Scalar Scalar;
46 typedef TensorCwiseBinaryOp<internal::scalar_sum_op<Scalar>,
const ExpressionType,
const OtherDerived> Sum;
47 Sum sum(m_expression, other);
48 typedef TensorAssignOp<ExpressionType, const Sum> Assign;
49 Assign assign(m_expression, sum);
50 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
54 template<
typename OtherDerived>
55 EIGEN_STRONG_INLINE
TensorDevice& operator-=(
const OtherDerived& other) {
56 typedef typename OtherDerived::Scalar Scalar;
57 typedef TensorCwiseBinaryOp<internal::scalar_difference_op<Scalar>,
const ExpressionType,
const OtherDerived> Difference;
58 Difference difference(m_expression, other);
59 typedef TensorAssignOp<ExpressionType, const Difference> Assign;
60 Assign assign(m_expression, difference);
61 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
66 const DeviceType& m_device;
67 ExpressionType& m_expression;
84 template <
typename ExpressionType,
typename DeviceType,
typename DoneCallback>
89 : m_device(device), m_expression(expression), m_done(std::move(done)) {}
91 template <
typename OtherDerived>
93 typedef TensorAssignOp<ExpressionType, const OtherDerived> Assign;
94 typedef internal::TensorExecutor<const Assign, DeviceType> Executor;
96 Assign assign(m_expression, other);
97 Executor::run(assign, m_device);
104 const DeviceType& m_device;
105 ExpressionType& m_expression;
110 #ifdef EIGEN_USE_THREADS
111 template <
typename ExpressionType,
typename DoneCallback>
116 : m_device(device), m_expression(expression), m_done(std::move(done)) {}
118 template <
typename OtherDerived>
119 EIGEN_STRONG_INLINE TensorAsyncDevice& operator=(
const OtherDerived& other) {
120 typedef TensorAssignOp<ExpressionType, const OtherDerived> Assign;
121 typedef internal::TensorAsyncExecutor<const Assign, ThreadPoolDevice, DoneCallback> Executor;
124 Assign assign(m_expression, other);
125 Executor::runAsync(assign, m_device, std::move(m_done));
131 const ThreadPoolDevice& m_device;
132 ExpressionType& m_expression;
Pseudo expression providing an operator = that will evaluate its argument asynchronously on the speci...
Definition: TensorDevice.h:85
Pseudo expression providing an operator = that will evaluate its argument on the specified computing ...
Definition: TensorDevice.h:29
Namespace containing all symbols from the Eigen library.