Commit 4465cb78 authored by Thibault Hallouin's avatar Thibault Hallouin
Browse files

check rank of data structures only if tensors

for arrays, rank is not applicable, so it should not be checked
1 merge request!6release v0.1.1
Pipeline #47788 passed with stage
in 3 minutes and 51 seconds
Showing with 40 additions and 23 deletions
+40 -23
...@@ -210,19 +210,25 @@ namespace evalhyd ...@@ -210,19 +210,25 @@ namespace evalhyd
xtl::missing<const std::vector<std::string>>() xtl::missing<const std::vector<std::string>>()
) )
{ {
// check ranks of tensors // check ranks of expressions if they are tensors
if (xt::get_rank<XD2>::value != 2) if (xt::get_rank<XD2>::value != SIZE_MAX)
{ {
throw std::runtime_error( if (xt::get_rank<XD2>::value != 2)
"observations and/or predictions and/or thresholds " {
"are not two-dimensional" throw std::runtime_error(
); "observations and/or predictions and/or thresholds "
"are not two-dimensional"
);
}
} }
if (xt::get_rank<XB3>::value != 3) if (xt::get_rank<XB3>::value != SIZE_MAX)
{ {
throw std::runtime_error( if (xt::get_rank<XB3>::value != 3)
"temporal masks are not three-dimensional" {
); throw std::runtime_error(
"temporal masks are not three-dimensional"
);
}
} }
// retrieve real types of the expressions // retrieve real types of the expressions
......
...@@ -190,24 +190,35 @@ namespace evalhyd ...@@ -190,24 +190,35 @@ namespace evalhyd
xtl::missing<const std::vector<std::string>>() xtl::missing<const std::vector<std::string>>()
) )
{ {
// check ranks of tensors // check ranks of expressions if they are tensors
if (xt::get_rank<XD2>::value != 2) if (xt::get_rank<XD2>::value != SIZE_MAX)
{ {
throw std::runtime_error( if (xt::get_rank<XD2>::value != 2)
"observations and/or thresholds are not two-dimensional" {
); throw std::runtime_error(
"observations and/or thresholds are not two-dimensional"
);
}
} }
if (xt::get_rank<XD4>::value != 4)
if (xt::get_rank<XD4>::value != SIZE_MAX)
{ {
throw std::runtime_error( if (xt::get_rank<XD4>::value != 4)
"predictions are not four-dimensional" {
); throw std::runtime_error(
"predictions are not four-dimensional"
);
}
} }
if (xt::get_rank<XB4>::value != 4)
if (xt::get_rank<XB4>::value != SIZE_MAX)
{ {
throw std::runtime_error( if (xt::get_rank<XB4>::value != 4)
"temporal masks are not four-dimensional" {
); throw std::runtime_error(
"temporal masks are not four-dimensional"
);
}
} }
// retrieve real types of the expressions // retrieve real types of the expressions
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment