Fix copying scalars by adding fill_gpu (#1402)

* fix copying scalars by adding fill_gpu

* Another copy scalar changed to fill

---------

Co-authored-by: Angelos Katharopoulos <a_katharopoulos@apple.com>
This commit is contained in:
Awni Hannun
2024-09-09 15:54:08 -07:00
committed by GitHub
parent 3ae6aabe9f
commit e7e59c6f05
7 changed files with 59 additions and 9 deletions

View File

@@ -2463,6 +2463,28 @@ TEST_CASE("test pad") {
CHECK_EQ(pad(x, 1).shape(), std::vector<int>{3, 4, 5});
CHECK_EQ(pad(x, {0, 1}).shape(), std::vector<int>{2, 3, 4});
CHECK_EQ(pad(x, {{1, 1}, {1, 2}, {3, 1}}).shape(), std::vector<int>{3, 5, 7});
x = array({1.0f, 2.0f, 3.0f, 4.0f}, {2, 2});
auto padded_x = pad(x, 1);
auto expected = array(
{0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
1.0f,
2.0f,
0.0f,
0.0f,
3.0f,
4.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f},
{4, 4});
CHECK(array_equal(padded_x, expected).item<bool>());
}
TEST_CASE("test power") {