10#ifndef EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
11#define EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
26template <
typename ExpressionType,
typename DeviceType>
29 TensorDevice(
const DeviceType& device, ExpressionType& expression) : m_device(device), m_expression(expression) {}
31 EIGEN_DEFAULT_COPY_CONSTRUCTOR(TensorDevice)
33 template<
typename OtherDerived>
34 EIGEN_STRONG_INLINE TensorDevice& operator=(
const OtherDerived& other) {
36 Assign assign(m_expression, other);
37 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
41 template<
typename OtherDerived>
42 EIGEN_STRONG_INLINE TensorDevice& operator+=(
const OtherDerived& other) {
43 typedef typename OtherDerived::Scalar
Scalar;
45 Sum sum(m_expression, other);
47 Assign assign(m_expression, sum);
48 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
52 template<
typename OtherDerived>
53 EIGEN_STRONG_INLINE TensorDevice& operator-=(
const OtherDerived& other) {
54 typedef typename OtherDerived::Scalar
Scalar;
56 Difference difference(m_expression, other);
58 Assign assign(m_expression, difference);
59 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
64 const DeviceType& m_device;
65 ExpressionType& m_expression;
82template <
typename ExpressionType,
typename DeviceType,
typename DoneCallback>
83class TensorAsyncDevice {
85 TensorAsyncDevice(
const DeviceType& device, ExpressionType& expression,
87 : m_device(device), m_expression(expression), m_done(std::move(done)) {}
89 template <
typename OtherDerived>
90 EIGEN_STRONG_INLINE TensorAsyncDevice& operator=(
const OtherDerived& other) {
94 Assign assign(m_expression, other);
95 Executor::run(assign, m_device);
102 const DeviceType& m_device;
103 ExpressionType& m_expression;
108#ifdef EIGEN_USE_THREADS
109template <
typename ExpressionType,
typename DoneCallback>
114 : m_device(device), m_expression(expression), m_done(std::move(done)) {}
116 template <
typename OtherDerived>
117 EIGEN_STRONG_INLINE TensorAsyncDevice& operator=(
const OtherDerived& other) {
118 typedef TensorAssignOp<ExpressionType, const OtherDerived> Assign;
119 typedef internal::TensorAsyncExecutor<const Assign, ThreadPoolDevice, DoneCallback> Executor;
122 Assign assign(m_expression, other);
123 Executor::runAsync(assign, m_device, std::move(m_done));
129 const ThreadPoolDevice& m_device;
130 ExpressionType& m_expression;
Definition TensorAssign.h:57
Pseudo expression providing an operator = that will evaluate its argument asynchronously on the speci...
Definition TensorDevice.h:83
Tensor binary expression.
Definition TensorExpr.h:198
The tensor executor class.
Definition TensorExecutor.h:79
Namespace containing all symbols from the Eigen library.