10#ifndef EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
11#define EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
14#include "./InternalHeaderCheck.h"
29template <
typename ExpressionType,
typename DeviceType>
32 TensorDevice(
const DeviceType& device, ExpressionType& expression) : m_device(device), m_expression(expression) {}
34 EIGEN_DEFAULT_COPY_CONSTRUCTOR(TensorDevice)
36 template <
typename OtherDerived>
37 EIGEN_STRONG_INLINE TensorDevice& operator=(
const OtherDerived& other) {
39 Assign assign(m_expression, other);
40 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
44 template <
typename OtherDerived>
45 EIGEN_STRONG_INLINE TensorDevice& operator+=(
const OtherDerived& other) {
46 typedef typename OtherDerived::Scalar
Scalar;
48 Sum sum(m_expression, other);
50 Assign assign(m_expression, sum);
51 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
55 template <
typename OtherDerived>
56 EIGEN_STRONG_INLINE TensorDevice& operator-=(
const OtherDerived& other) {
57 typedef typename OtherDerived::Scalar
Scalar;
60 Difference difference(m_expression, other);
62 Assign assign(m_expression, difference);
63 internal::TensorExecutor<const Assign, DeviceType>::run(assign, m_device);
68 const DeviceType& m_device;
69 ExpressionType& m_expression;
86template <
typename ExpressionType,
typename DeviceType,
typename DoneCallback>
87class TensorAsyncDevice {
89 TensorAsyncDevice(
const DeviceType& device, ExpressionType& expression, DoneCallback done)
90 : m_device(device), m_expression(expression), m_done(std::move(done)) {}
92 template <
typename OtherDerived>
93 EIGEN_STRONG_INLINE TensorAsyncDevice& operator=(
const OtherDerived& other) {
97 Assign assign(m_expression, other);
98 Executor::run(assign, m_device);
105 const DeviceType& m_device;
106 ExpressionType& m_expression;
110#ifdef EIGEN_USE_THREADS
111template <
typename ExpressionType,
typename DoneCallback>
114 TensorAsyncDevice(
const ThreadPoolDevice& device, ExpressionType& expression, DoneCallback done)
115 : m_device(device), m_expression(expression), m_done(std::move(done)) {}
117 template <
typename OtherDerived>
118 EIGEN_STRONG_INLINE TensorAsyncDevice& operator=(
const OtherDerived& other) {
119 typedef TensorAssignOp<ExpressionType, const OtherDerived> Assign;
120 typedef internal::TensorAsyncExecutor<const Assign, ThreadPoolDevice, DoneCallback> Executor;
123 Assign assign(m_expression, other);
124 Executor::runAsync(assign, m_device, std::move(m_done));
130 const ThreadPoolDevice& m_device;
131 ExpressionType& m_expression;
Definition TensorAssign.h:55
Pseudo expression providing an operator = that will evaluate its argument asynchronously on the speci...
Definition TensorDevice.h:87
Tensor binary expression.
Definition TensorExpr.h:171
The tensor executor class.
Definition TensorExecutor.h:76
Namespace containing all symbols from the Eigen library.