12 #include <Eigen/CXX11/Tensor> 20 ftensor = ftensor.random() * 100.f;
26 chartensor = ftensor.cast<
char>();
27 cplextensor = ftensor.cast<std::complex<float> >();
29 for (
int i = 0;
i < 20; ++
i) {
30 for (
int j = 0;
j < 30; ++
j) {
41 itensor = itensor.random() / 1000;
47 ftensor = itensor.cast<
float>();
48 dtensor = itensor.cast<
double>();
50 for (
int i = 0;
i < 20; ++
i) {
51 for (
int j = 0;
j < 30; ++
j) {
62 ftensor = ftensor.random() * 1000.0f;
64 dtensor = dtensor.random() * 1000.0;
69 for (
int i = 0;
i < 20; ++
i) {
70 for (
int j = 0;
j < 30; ++
j) {
83 ftensor = dtensor.cast<
float>();
85 for (
int i = 0;
i < 20; ++
i) {
86 for (
int j = 0;
j < 30; ++
j) {
98 dtensor = ftensor.cast<
double>();
100 for (
int i = 0;
i < 20; ++
i) {
101 for (
int j = 0;
j < 30; ++
j) {
void test_cxx11_tensor_casts()
static void test_simple_cast()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom()
static void test_vectorized_cast()
static void test_small_to_big_type_cast()
#define VERIFY_IS_APPROX(a, b)
#define VERIFY_IS_EQUAL(a, b)
static void test_big_to_small_type_cast()
static void test_float_to_int_cast()
#define CALL_SUBTEST(FUNC)