Back out "[pytorch][PR] ENH Adds dtype to nn.functional.one_hot" (#59080)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59080

Original commit changeset: 3686579517cc

Test Plan: None; reverting diff

Reviewed By: albanD

Differential Revision: D28746799

fbshipit-source-id: 75a7885ab0bf3abadde9a42b56d479f71f57c89c
This commit is contained in:
Joel Schlosser
2021-05-27 15:37:39 -07:00
committed by Facebook GitHub Bot
parent 3d2b55553b
commit ef32a29c97
11 changed files with 39 additions and 65 deletions
-11
View File
@@ -1061,17 +1061,6 @@ TEST_F(FunctionalTest, OneHot) {
ASSERT_TRUE(torch::allclose(y, expected));
ASSERT_EQ(y.sizes(), std::vector<int64_t>({3, 2, 3}));
}
{ // Test #4
auto x = torch::arange(0, 5, torch::kLong);
auto y = F::one_hot(x % 3, 3, torch::kUInt8);
auto expected = torch::tensor(
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {1, 0, 0}, {0, 1, 0}}, torch::kUInt8);
ASSERT_EQ(y.ndimension(), 2);
ASSERT_TRUE(torch::allclose(y, expected));
ASSERT_EQ(y.sizes(), std::vector<int64_t>({5, 3}));
}
}
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)