mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-20 22:52:51 +08:00
Made the testing of contractions on fp16 more robust
This commit is contained in:
parent
e3d053e14e
commit
678a17ba79
@ -219,7 +219,7 @@ void test_cuda_contractions() {
|
|||||||
d_res_float, rows, cols);
|
d_res_float, rows, cols);
|
||||||
|
|
||||||
gpu_float1.device(gpu_device) = gpu_float1.random() - gpu_float1.constant(0.5f);
|
gpu_float1.device(gpu_device) = gpu_float1.random() - gpu_float1.constant(0.5f);
|
||||||
gpu_float2.device(gpu_device) = gpu_float2.random() - gpu_float1.constant(0.5f);
|
gpu_float2.device(gpu_device) = gpu_float2.random() - gpu_float2.constant(0.5f);
|
||||||
|
|
||||||
typedef Tensor<float, 2>::DimensionPair DimPair;
|
typedef Tensor<float, 2>::DimensionPair DimPair;
|
||||||
Eigen::array<DimPair, 1> dims(DimPair(1, 0));
|
Eigen::array<DimPair, 1> dims(DimPair(1, 0));
|
||||||
@ -234,8 +234,10 @@ void test_cuda_contractions() {
|
|||||||
|
|
||||||
for (int i = 0; i < rows; ++i) {
|
for (int i = 0; i < rows; ++i) {
|
||||||
for (int j = 0; j < cols; ++j) {
|
for (int j = 0; j < cols; ++j) {
|
||||||
std::cout << "Checking contract " << i << " " << j << std::endl;
|
std::cout << "Checking contract " << i << " " << j << full_prec(i, j) << " " << half_prec(i, j) << std::endl;
|
||||||
VERIFY_IS_APPROX(full_prec(i, j), half_prec(i, j));
|
if (numext::abs(full_prec(i, j) - half_prec(i, j)) > Eigen::half(1e-2f)) {
|
||||||
|
VERIFY_IS_APPROX(full_prec(i, j), half_prec(i, j));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user