10#ifndef EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
11#define EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
27template <
typename ExpressionType,
typename DeviceType>
class TensorDevice {
29 TensorDevice(
const DeviceType& device, ExpressionType& expression) : m_device(device), m_expression(expression) {}
33 template<
typename OtherDerived>
34 EIGEN_STRONG_INLINE
TensorDevice& operator=(
const OtherDerived& other) {
35 typedef TensorAssignOp<ExpressionType, const OtherDerived> Assign;
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;
44 typedef TensorCwiseBinaryOp<internal::scalar_sum_op<Scalar>,
const ExpressionType,
const OtherDerived> Sum;
45 Sum sum(m_expression, other);
46 typedef TensorAssignOp<ExpressionType, const Sum> Assign;
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;
55 typedef TensorCwiseBinaryOp<internal::scalar_difference_op<Scalar>,
const ExpressionType,
const OtherDerived> Difference;
56 Difference difference(m_expression, other);
57 typedef TensorAssignOp<ExpressionType, const Difference> Assign;
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>
87 : m_device(device), m_expression(expression), m_done(std::move(done)) {}
89 template <
typename OtherDerived>
91 typedef TensorAssignOp<ExpressionType, const OtherDerived> Assign;
92 typedef internal::TensorExecutor<const Assign, DeviceType> Executor;
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;
Pseudo expression providing an operator = that will evaluate its argument asynchronously on the speci...
Definition: TensorDevice.h:83
Pseudo expression providing an operator = that will evaluate its argument on the specified computing ...
Definition: TensorDevice.h:27
Namespace containing all symbols from the Eigen library.