10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_INITIALIZER_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_INITIALIZER_H
13 #include <initializer_list>
26 template <
typename Derived,
int N>
28 typedef std::initializer_list<
29 typename Initializer<Derived, N - 1>::InitList> InitList;
31 static void run(TensorEvaluator<Derived, DefaultDevice>& tensor,
33 const InitList& vals) {
35 for (
const auto& v : vals) {
37 Initializer<Derived, N - 1>::run(tensor, indices, v);
42 template <
typename Derived>
43 struct Initializer<Derived, 1> {
44 typedef std::initializer_list<typename traits<Derived>::Scalar> InitList;
46 static void run(TensorEvaluator<Derived, DefaultDevice>& tensor,
48 const InitList& vals) {
51 for (
const auto& v : vals) {
53 tensor.coeffRef(*indices) =
v;
58 template <
typename Derived>
59 struct Initializer<Derived, 0> {
62 static void run(TensorEvaluator<Derived, DefaultDevice>& tensor,
65 tensor.coeffRef(0) =
v;
70 template <
typename Derived,
int N>
74 Initializer<Derived, traits<Derived>::NumDimensions>::run(tensor, &indices, vals);
Array< int, Dynamic, 1 > v
void initialize_tensor(TensorEvaluator< Derived, DefaultDevice > &tensor, const typename Initializer< Derived, traits< Derived >::NumDimensions >::InitList &vals)
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend
A cost model used to limit the number of threads used for evaluating tensor expression.