mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 11:19:02 +08:00
Fixing TensorArgMaxSycl.h; Removing warning related to the hardcoded type of dims to be int in Argmax.
This commit is contained in:
parent
a91417a7a5
commit
bd64ee8555
@ -178,7 +178,7 @@ class TensorTupleReducerOp : public TensorBase<TensorTupleReducerOp<ReduceOp, Di
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorTupleReducerOp(const XprType& expr,
|
||||
const ReduceOp& reduce_op,
|
||||
const int return_dim,
|
||||
const Index return_dim,
|
||||
const Dims& reduce_dims)
|
||||
: m_xpr(expr), m_reduce_op(reduce_op), m_return_dim(return_dim), m_reduce_dims(reduce_dims) {}
|
||||
|
||||
@ -193,12 +193,12 @@ class TensorTupleReducerOp : public TensorBase<TensorTupleReducerOp<ReduceOp, Di
|
||||
const Dims& reduce_dims() const { return m_reduce_dims; }
|
||||
|
||||
EIGEN_DEVICE_FUNC
|
||||
int return_dim() const { return m_return_dim; }
|
||||
Index return_dim() const { return m_return_dim; }
|
||||
|
||||
protected:
|
||||
typename XprType::Nested m_xpr;
|
||||
const ReduceOp m_reduce_op;
|
||||
const int m_return_dim;
|
||||
const Index m_return_dim;
|
||||
const Dims m_reduce_dims;
|
||||
};
|
||||
|
||||
@ -262,7 +262,7 @@ struct TensorEvaluator<const TensorTupleReducerOp<ReduceOp, Dims, ArgType>, Devi
|
||||
EIGEN_DEVICE_FUNC Scalar* data() const { return NULL; }
|
||||
#else // following functions are required by sycl
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TupleType* data() const { return m_impl.data(); }
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int return_dim() const {return m_return_dim;}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index return_dim() const {return m_return_dim;}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const StrideDims& strides() const {return m_strides;}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Index& stride_mod() const {return m_stride_mod;}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Index& stride_div() const {return m_stride_div;}
|
||||
@ -303,7 +303,7 @@ struct TensorEvaluator<const TensorTupleReducerOp<ReduceOp, Dims, ArgType>, Devi
|
||||
protected:
|
||||
TensorEvaluator<const TensorIndexTupleOp<ArgType>, Device> m_orig_impl;
|
||||
TensorEvaluator<const TensorReductionOp<ReduceOp, Dims, const TensorIndexTupleOp<ArgType> >, Device> m_impl;
|
||||
const int m_return_dim;
|
||||
const Index m_return_dim;
|
||||
StrideDims m_strides;
|
||||
Index m_stride_mod;
|
||||
Index m_stride_div;
|
||||
|
@ -61,9 +61,9 @@ class TensorTupleReducerDeviceOp : public TensorBase<TensorTupleReducerDeviceOp<
|
||||
typedef typename XprType::CoeffReturnType CoeffReturnType;
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorTupleReducerDeviceOp(XprType expr,
|
||||
const int return_dim,
|
||||
const StrideDims& strides,
|
||||
const Index& stride_mod, const Index& stride_div)
|
||||
const Index return_dim,
|
||||
const StrideDims strides,
|
||||
const Index stride_mod, const Index stride_div)
|
||||
:m_xpr(expr), m_return_dim(return_dim), m_strides(strides), m_stride_mod(stride_mod), m_stride_div(stride_div) {}
|
||||
|
||||
EIGEN_DEVICE_FUNC
|
||||
@ -71,7 +71,7 @@ class TensorTupleReducerDeviceOp : public TensorBase<TensorTupleReducerDeviceOp<
|
||||
expression() const { return m_xpr; }
|
||||
|
||||
EIGEN_DEVICE_FUNC
|
||||
int return_dim() const { return m_return_dim; }
|
||||
Index return_dim() const { return m_return_dim; }
|
||||
|
||||
EIGEN_DEVICE_FUNC
|
||||
const StrideDims& strides() const { return m_strides; }
|
||||
@ -86,8 +86,8 @@ class TensorTupleReducerDeviceOp : public TensorBase<TensorTupleReducerDeviceOp<
|
||||
typename Eigen::internal::remove_all<typename
|
||||
XprType::Nested
|
||||
>::type m_xpr;
|
||||
const int m_return_dim;
|
||||
const StrideDims& m_strides;
|
||||
const Index m_return_dim;
|
||||
const StrideDims m_strides;
|
||||
const Index m_stride_mod;
|
||||
const Index m_stride_div;
|
||||
};
|
||||
@ -137,10 +137,10 @@ typedef typename MakeGlobalPointer<typename TensorEvaluator<ArgType , SyclKernel
|
||||
|
||||
protected:
|
||||
TensorEvaluator<ArgType , SyclKernelDevice> m_impl;
|
||||
const int m_return_dim;
|
||||
const StrideDims& m_strides;
|
||||
const Index& m_stride_mod;
|
||||
const Index& m_stride_div;
|
||||
const Index m_return_dim;
|
||||
const StrideDims m_strides;
|
||||
const Index m_stride_mod;
|
||||
const Index m_stride_div;
|
||||
};
|
||||
} // end namespace Eigen
|
||||
#endif //UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSOR_ARGMAX_SYCL_HPP
|
||||
|
@ -619,7 +619,7 @@ class TensorBase<Derived, ReadOnlyAccessors>
|
||||
const array<Index, NumDimensions>, const Derived>
|
||||
argmax() const {
|
||||
array<Index, NumDimensions> in_dims;
|
||||
for (int d = 0; d < NumDimensions; ++d) in_dims[d] = d;
|
||||
for (Index d = 0; d < NumDimensions; ++d) in_dims[d] = d;
|
||||
return TensorTupleReducerOp<
|
||||
internal::ArgMaxTupleReducer<Tuple<Index, CoeffReturnType> >,
|
||||
const array<Index, NumDimensions>,
|
||||
@ -632,7 +632,7 @@ class TensorBase<Derived, ReadOnlyAccessors>
|
||||
const array<Index, NumDimensions>, const Derived>
|
||||
argmin() const {
|
||||
array<Index, NumDimensions> in_dims;
|
||||
for (int d = 0; d < NumDimensions; ++d) in_dims[d] = d;
|
||||
for (Index d = 0; d < NumDimensions; ++d) in_dims[d] = d;
|
||||
return TensorTupleReducerOp<
|
||||
internal::ArgMinTupleReducer<Tuple<Index, CoeffReturnType> >,
|
||||
const array<Index, NumDimensions>,
|
||||
@ -643,7 +643,7 @@ class TensorBase<Derived, ReadOnlyAccessors>
|
||||
const TensorTupleReducerOp<
|
||||
internal::ArgMaxTupleReducer<Tuple<Index, CoeffReturnType> >,
|
||||
const array<Index, 1>, const Derived>
|
||||
argmax(const int return_dim) const {
|
||||
argmax(const Index return_dim) const {
|
||||
array<Index, 1> in_dims;
|
||||
in_dims[0] = return_dim;
|
||||
return TensorTupleReducerOp<
|
||||
@ -656,7 +656,7 @@ class TensorBase<Derived, ReadOnlyAccessors>
|
||||
const TensorTupleReducerOp<
|
||||
internal::ArgMinTupleReducer<Tuple<Index, CoeffReturnType> >,
|
||||
const array<Index, 1>, const Derived>
|
||||
argmin(const int return_dim) const {
|
||||
argmin(const Index return_dim) const {
|
||||
array<Index, 1> in_dims;
|
||||
in_dims[0] = return_dim;
|
||||
return TensorTupleReducerOp<
|
||||
|
@ -268,7 +268,7 @@ struct TensorEvaluator<const TensorPatchOp<PatchDim, ArgType>, Device>
|
||||
|
||||
TensorEvaluator<ArgType, Device> m_impl;
|
||||
// required by sycl
|
||||
const PatchDim& patch_dims;
|
||||
const PatchDim patch_dims;
|
||||
};
|
||||
|
||||
} // end namespace Eigen
|
||||
|
@ -791,7 +791,7 @@ static const bool RunningOnGPU = false;
|
||||
typename MakePointer_<CoeffReturnType>::Type m_result;
|
||||
|
||||
const Device& m_device;
|
||||
const Dims& m_xpr_dims;
|
||||
const Dims m_xpr_dims;
|
||||
};
|
||||
|
||||
} // end namespace Eigen
|
||||
|
@ -230,15 +230,15 @@ template<typename ReduceOp, typename Dims, typename ArgType, typename Device>\
|
||||
typedef typename Evaluator::Index Index;\
|
||||
typedef typename Eigen::internal::conditional<NumOutputDims==0, DSizes<Index, 1>, typename Evaluator::Dimensions >::type Dimensions;\
|
||||
const Dimensions m_dimensions;\
|
||||
const int m_return_dim;\
|
||||
const Index m_return_dim;\
|
||||
const StrideDims m_strides;\
|
||||
const Index m_stride_mod;\
|
||||
const Index m_stride_div;\
|
||||
EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }\
|
||||
EIGEN_STRONG_INLINE int return_dim() const {return m_return_dim;}\
|
||||
EIGEN_STRONG_INLINE const StrideDims& strides() const {return m_strides;}\
|
||||
EIGEN_STRONG_INLINE const Index& stride_mod() const {return m_stride_mod;}\
|
||||
EIGEN_STRONG_INLINE const Index& stride_div() const {return m_stride_div;}\
|
||||
EIGEN_STRONG_INLINE Index return_dim() const {return m_return_dim;}\
|
||||
EIGEN_STRONG_INLINE const StrideDims strides() const {return m_strides;}\
|
||||
EIGEN_STRONG_INLINE const Index stride_mod() const {return m_stride_mod;}\
|
||||
EIGEN_STRONG_INLINE const Index stride_div() const {return m_stride_div;}\
|
||||
FunctorExtractor(const TensorEvaluator<CVQual TensorTupleReducerOp<ReduceOp, Dims, ArgType>, Device>& expr)\
|
||||
: m_dimensions(DimConstr<Dimensions, NumOutputDims>::getDim(expr.dimensions())), m_return_dim(expr.return_dim()),\
|
||||
m_strides(expr.strides()), m_stride_mod(expr.stride_mod()), m_stride_div(expr.stride_div()){}\
|
||||
|
@ -143,10 +143,6 @@ static void test_sycl_argmax_dim(const Eigen::SyclDevice &sycl_device)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename DataType, int DataLayout, typename DenseIndex>
|
||||
static void test_sycl_argmin_dim(const Eigen::SyclDevice &sycl_device)
|
||||
{
|
||||
@ -242,9 +238,8 @@ template<typename DataType, typename Device_Selector> void sycl_argmax_test_per_
|
||||
}
|
||||
|
||||
void test_cxx11_tensor_argmax_sycl() {
|
||||
// TODO {lukei}: re-enable once fixed
|
||||
/* for (const auto& device :Eigen::get_sycl_supported_devices()) {
|
||||
for (const auto& device :Eigen::get_sycl_supported_devices()) {
|
||||
CALL_SUBTEST(sycl_argmax_test_per_device<double>(device));
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user