Skip to content

Commit ae1f3ed

Browse files
authored
Forward fix for D84506893
Differential Revision: D84525208 Pull Request resolved: #15068
1 parent 19c9ff3 commit ae1f3ed

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

extension/llm/runner/test/test_util.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
#include <executorch/extension/llm/runner/util.h>
10-
#include <executorch/extension/tensor/tensor_ptr_maker.h>
10+
#include <executorch/runtime/platform/runtime.h>
1111

1212
#include <gtest/gtest.h>
1313

@@ -19,7 +19,14 @@ using ::executorch::aten::ScalarType;
1919
using ::executorch::extension::make_tensor_ptr;
2020
using ::executorch::extension::llm::convert_to_bfloat16;
2121

22-
TEST(ConvertToBFloat16Test, ConvertsFloatTensorData) {
22+
class ConvertToBFloat16Test : public ::testing::Test {
23+
protected:
24+
void SetUp() override {
25+
executorch::runtime::runtime_init();
26+
}
27+
};
28+
29+
TEST_F(ConvertToBFloat16Test, ConvertsFloatTensorData) {
2330
auto source_tensor = make_tensor_ptr<float>(
2431
{2, 2}, std::vector<float>{0.0f, 1.5f, -2.0f, 3.25f});
2532

@@ -47,7 +54,7 @@ TEST(ConvertToBFloat16Test, ConvertsFloatTensorData) {
4754
}
4855
}
4956

50-
TEST(ConvertToBFloat16Test, RejectsNonFloatTensor) {
57+
TEST_F(ConvertToBFloat16Test, RejectsNonFloatTensor) {
5158
auto non_float_tensor =
5259
make_tensor_ptr<int64_t>({3}, std::vector<int64_t>{1, 2, 3});
5360

0 commit comments

Comments
 (0)