11#ifndef EIGEN_TENSOR_TENSOR_DEVICE_H
12#define EIGEN_TENSOR_TENSOR_DEVICE_H
15#include "./InternalHeaderCheck.h"
30template <
typename ExpressionType,
typename DeviceType>
33 TensorDevice(
const DeviceType& device, ExpressionType& expression) : m_device(device), m_expression(expression) {}
35 EIGEN_DEFAULT_COPY_CONSTRUCTOR(TensorDevice)
37 template <
typename OtherDerived>
38 EIGEN_STRONG_INLINE TensorDevice& operator=(
const OtherDerived& other) {
40 Assign assign(m_expression, other);
41 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
45 template <
typename OtherDerived>
46 EIGEN_STRONG_INLINE TensorDevice& operator+=(
const OtherDerived& other) {
47 typedef typename OtherDerived::Scalar Scalar;
49 Sum sum(m_expression, other);
51 Assign assign(m_expression, sum);
52 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
56 template <
typename OtherDerived>
57 EIGEN_STRONG_INLINE TensorDevice& operator-=(
const OtherDerived& other) {
58 typedef typename OtherDerived::Scalar Scalar;
61 Difference difference(m_expression, other);
63 Assign assign(m_expression, difference);
64 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
69 const DeviceType& m_device;
70 ExpressionType& m_expression;
87template <
typename ExpressionType,
typename DeviceType,
typename DoneCallback>
88class TensorAsyncDevice {
90 TensorAsyncDevice(
const DeviceType& device, ExpressionType& expression, DoneCallback done)
91 : m_device(device), m_expression(expression), m_done(std::move(done)) {}
93 template <
typename OtherDerived>
94 EIGEN_STRONG_INLINE TensorAsyncDevice& operator=(
const OtherDerived& other) {
98 Assign assign(m_expression, other);
99 Executor::run(assign, m_device);
106 const DeviceType& m_device;
107 ExpressionType& m_expression;
111#ifdef EIGEN_USE_THREADS
112template <
typename ExpressionType,
typename DoneCallback>
115 TensorAsyncDevice(
const ThreadPoolDevice& device, ExpressionType& expression, DoneCallback done)
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;
Definition TensorAssign.h:47
Pseudo expression providing an operator = that will evaluate its argument asynchronously on the speci...
Definition TensorDevice.h:88
Tensor binary expression.
Definition TensorExpr.h:153
The tensor executor class.
Definition TensorExecutor.h:38
Namespace containing all symbols from the Eigen library.