Skip to content

Instantly share code, notes, and snippets.

@taless474
Created May 7, 2020 03:51
Show Gist options
  • Save taless474/c2624c05ac48b72cc0cf9198de1ade59 to your computer and use it in GitHub Desktop.
Save taless474/c2624c05ac48b72cc0cf9198de1ade59 to your computer and use it in GitHub Desktop.
void test_expand_dims_1d_3()
{
if (hpx::get_locality_id() == 0)
{
test_expand_dims_operation("test_expand_dims_2loc1d_3", R"(
expand_dims(
annotate_d([1., 2., 3., 4.], "array_3",
list("tile", list("columns", 4, 8)))
, -1)
)", R"(
annotate_d([[1.], [2.], [3.], [4.]], "array_3_expanded/1",
list("args",
list("locality", 0, 2),
list("tile", list("columns", 0, 1), list("rows", 4, 8))))
)");
}
else
{
test_expand_dims_operation("test_expand_dims_2loc1d_3", R"(
expand_dims(
annotate_d([-3, -2, -1, 0], "array_3",
list("tile", list("columns", 0, 4)))
, -1)
)", R"(
annotate_d([[-3.], [-2.], [-1.], [0.]], "array_3_expanded/1",
list("args",
list("locality", 1, 2),
list("tile", list("columns", 0, 1), list("rows", 0, 4))))
)");
}
}
// doesn't pass, the dtype
void test_expand_dims_1d_3()
{
if (hpx::get_locality_id() == 0)
{
test_expand_dims_operation("test_expand_dims_2loc1d_3", R"(
expand_dims(
annotate_d([1., 2., 3., 4.], "array_3",
list("tile", list("columns", 4, 8)))
, -1)
)", R"(
annotate_d([[1.], [2.], [3.], [4.]], "array_3_expanded/1",
list("args",
list("locality", 0, 2),
list("tile", list("columns", 0, 1), list("rows", 4, 8))))
)");
}
else
{
test_expand_dims_operation("test_expand_dims_2loc1d_3", R"(
expand_dims(
annotate_d([-3, -2, -1, 0.], "array_3",
list("tile", list("columns", 8, 12)))
, -1)
)", R"(
annotate_d([[-3.], [-2.], [-1.], [0.]], "array_3_expanded/1",
list("args",
list("locality", 1, 2),
list("tile", list("columns", 0, 1), list("rows", 8, 12))))
)");
}
}
//passes although array doesn't start from zero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment