10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_META_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_META_H 14 #include "./InternalHeaderCheck.h" 21 template <
typename T1,
typename T2>
22 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
const T1& choose(Cond<true>,
const T1& first,
const T2&) {
26 template <
typename T1,
typename T2>
27 EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
const T2& choose(Cond<false>,
const T1&,
const T2& second) {
33 static const size_t size = n;
37 static const size_t size = 1;
41 EIGEN_DEPRECATED EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE constexpr T divup(
const T x,
const T y) {
42 return Eigen::numext::div_ceil(x, y);
46 template <
typename Scalar,
typename Device>
47 struct PacketType : internal::packet_traits<Scalar> {
48 typedef typename internal::packet_traits<Scalar>::type type;
52 #if defined(EIGEN_USE_GPU) && defined(EIGEN_HAS_GPU_FP16) && defined(EIGEN_GPU_COMPILE_PHASE) 54 typedef ulonglong2 Packet4h2;
56 struct PacketType<half, GpuDevice> {
57 typedef Packet4h2 type;
58 static const int size = 8;
86 #if defined(EIGEN_USE_SYCL) 88 namespace TensorSycl {
91 template <
typename Index, Index A, Index B>
93 static constexpr
Index Value = A + B;
96 template <
typename Index, Index A, Index B>
98 static constexpr
Index Value = A / B;
103 template <
typename UnaryOperator>
104 static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void loop(UnaryOperator op) {
106 static_for<Index, StepOp<Index, start, step>::Value,
end, step, StepOp>::loop(op);
109 template <
typename Index,
Index end,
Index step,
template <
class Indx, Indx...>
class StepOp>
111 template <
typename UnaryOperator>
112 static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void loop(UnaryOperator) {}
115 template <
typename OutScalar,
typename Device,
bool Vectorizable>
117 static constexpr
int PacketSize = 1;
118 typedef OutScalar PacketReturnType;
121 template <
typename OutScalar,
typename Device>
122 struct Vectorise<OutScalar, Device, true> {
123 static constexpr
int PacketSize = Eigen::PacketType<OutScalar, Device>::size;
124 typedef typename Eigen::PacketType<OutScalar, Device>::type PacketReturnType;
127 static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
Index roundUp(
Index x,
Index y) {
return ((((x) + (y)-1) / (y)) * (y)); }
133 struct PacketType<half, SyclDevice> {
135 static const int size = 1;
151 template <
typename Scalar>
152 struct PacketType<Scalar, SyclDevice> : internal::default_packet_traits {
174 template <
typename Scalar>
175 struct PacketType<Scalar, const SyclDevice> : PacketType<Scalar, SyclDevice> {};
177 #ifndef EIGEN_DONT_VECTORIZE_SYCL 178 #define PACKET_TYPE(CVQual, Type, val, lengths, DEV) \ 180 struct PacketType<CVQual Type, DEV> : internal::sycl_packet_traits<val, lengths> { \ 181 typedef typename internal::packet_traits<Type>::type type; \ 182 typedef typename internal::packet_traits<Type>::half half; \ 185 PACKET_TYPE(
const,
float, 1, 4, SyclDevice)
186 PACKET_TYPE(,
float, 1, 4, SyclDevice)
187 PACKET_TYPE(
const,
float, 1, 4,
const SyclDevice)
188 PACKET_TYPE(,
float, 1, 4,
const SyclDevice)
190 PACKET_TYPE(
const,
double, 0, 2, SyclDevice)
191 PACKET_TYPE(,
double, 0, 2, SyclDevice)
192 PACKET_TYPE(
const,
double, 0, 2,
const SyclDevice)
193 PACKET_TYPE(,
double, 0, 2,
const SyclDevice)
197 struct PacketType<half, const SyclDevice> : PacketType<half, SyclDevice> {};
199 struct PacketType<const half, const SyclDevice> : PacketType<half, SyclDevice> {};
204 template <
typename U,
typename V>
207 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
212 typedef U first_type;
213 typedef V second_type;
215 constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Pair() : first(), second() {}
217 constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Pair(
const U& f,
const V& s) : first(f), second(s) {}
219 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void swap(Pair& rhs) {
221 swap(first, rhs.first);
222 swap(second, rhs.second);
226 template <
typename U,
typename V>
227 constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
bool operator==(
const Pair<U, V>& x,
const Pair<U, V>& y) {
228 return (x.first == y.first && x.second == y.second);
231 template <
typename U,
typename V>
232 constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
bool operator!=(
const Pair<U, V>& x,
const Pair<U, V>& y) {
237 template <
typename Idx>
239 constexpr EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE IndexPair() : first(0), second(0) {}
240 constexpr EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE IndexPair(Idx f, Idx s) : first(f), second(s) {}
242 EIGEN_DEVICE_FUNC
void set(IndexPair<Idx> val) {
253 template <
typename IndexType,
typename Index,
Index First,
Index... Is>
254 constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE array<
Index, 1 +
sizeof...(Is)> customIndices2Array(
255 IndexType& idx, numeric_list<Index, First, Is...>) {
256 return {
static_cast<Index>(idx[First]), static_cast<Index>(idx[Is])...};
258 template <
typename IndexType,
typename Index>
259 constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE array<Index, 0> customIndices2Array(IndexType&, numeric_list<Index>) {
260 return array<Index, 0>();
264 template <
typename Index, std::
size_t NumIndices,
typename IndexType>
265 constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE array<Index, NumIndices> customIndices2Array(IndexType& idx) {
266 return customIndices2Array(idx,
typename gen_numeric_list<Index, NumIndices>::type{});
269 template <
typename B,
typename D>
271 typedef char (&yes)[1];
272 typedef char (&no)[2];
274 template <
typename BB,
typename DD>
276 operator BB*()
const;
280 template <
typename T>
281 static yes check(D*, T);
282 static no check(B*,
int);
284 static const bool value =
sizeof(check(Host<B, D>(),
int())) ==
sizeof(yes);
291 #endif // EIGEN_CXX11_TENSOR_TENSOR_META_H static constexpr lastp1_t end
Namespace containing all symbols from the Eigen library.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
std::enable_if_t< std::is_base_of< DenseBase< std::decay_t< DerivedA > >, std::decay_t< DerivedA > >::value &&std::is_base_of< DenseBase< std::decay_t< DerivedB > >, std::decay_t< DerivedB > >::value, void > swap(DerivedA &&a, DerivedB &&b)