Skip to content

[executorch] FileDataLoader::From -> ::from for all of //executorch #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/bundled_executor_runner/bundled_executor_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ int main(int argc, char** argv) {
// DataLoaders that use mmap() or point to data that's already in memory, and
// users can create their own DataLoaders to load from arbitrary sources.
const char* model_path = FLAGS_model_path.c_str();
Result<FileDataLoader> loader = FileDataLoader::From(model_path);
Result<FileDataLoader> loader = FileDataLoader::from(model_path);
ET_CHECK_MSG(
loader.ok(), "FileDataLoader::From() failed: 0x%" PRIx32, loader.error());
loader.ok(), "FileDataLoader::from() failed: 0x%" PRIx32, loader.error());

// Read in the entire file.
Result<FreeableBuffer> file_data = loader->Load(0, loader->size().get());
Expand Down
4 changes: 2 additions & 2 deletions examples/executor_runner/executor_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ int main(int argc, char** argv) {
// DataLoaders that use mmap() or point to data that's already in memory, and
// users can create their own DataLoaders to load from arbitrary sources.
const char* model_path = FLAGS_model_path.c_str();
Result<FileDataLoader> loader = FileDataLoader::From(model_path);
Result<FileDataLoader> loader = FileDataLoader::from(model_path);
ET_CHECK_MSG(
loader.ok(), "FileDataLoader::From() failed: 0x%" PRIx32, loader.error());
loader.ok(), "FileDataLoader::from() failed: 0x%" PRIx32, loader.error());

// Parse the program file. This is immutable, and can also be reused between
// multiple execution invocations across multiple threads.
Expand Down
2 changes: 1 addition & 1 deletion runtime/executor/test/allocation_failure_stress_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AllocationFailureStressTest : public ::testing::Test {
void SetUp() override {
// Create a loader for the serialized ModuleAdd program.
const char* path = std::getenv("ET_MODULE_ADD_PATH");
Result<FileDataLoader> loader = FileDataLoader::From(path);
Result<FileDataLoader> loader = FileDataLoader::from(path);
ASSERT_EQ(loader.error(), Error::Ok);
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));

Expand Down
8 changes: 4 additions & 4 deletions runtime/executor/test/backend_integration_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ TEST_P(BackendIntegrationTest, BackendIsPresent) {

// Demonstrate that installed StubBackend initializes successfully by default.
TEST_P(BackendIntegrationTest, BasicInitSucceeds) {
Result<FileDataLoader> loader = FileDataLoader::From(program_path());
Result<FileDataLoader> loader = FileDataLoader::from(program_path());
ASSERT_EQ(loader.error(), Error::Ok);

Result<Program> program = Program::Load(&loader.get());
Expand Down Expand Up @@ -321,7 +321,7 @@ TEST_P(BackendIntegrationTest, FreeingProcessedBufferSucceeds) {

// Wrap the real loader in a spy so we can see which operations were
// performed.
Result<FileDataLoader> loader = FileDataLoader::From(program_path());
Result<FileDataLoader> loader = FileDataLoader::from(program_path());
ASSERT_EQ(loader.error(), Error::Ok);
DataLoaderSpy spy_loader(&loader.get());

Expand Down Expand Up @@ -385,7 +385,7 @@ TEST_P(BackendIntegrationTest, EndToEndTestWithProcessedAsHandle) {

// Wrap the real loader in a spy so we can see which operations were
// performed.
Result<FileDataLoader> loader = FileDataLoader::From(program_path());
Result<FileDataLoader> loader = FileDataLoader::from(program_path());
ASSERT_EQ(loader.error(), Error::Ok);
DataLoaderSpy spy_loader(&loader.get());

Expand Down Expand Up @@ -530,7 +530,7 @@ TEST_P(DelegateDataAlignmentTest, ExpectedDataAlignment) {

// Create a loader that can satisfy the alignment required by this program.
Result<FileDataLoader> loader =
FileDataLoader::From(program_path(), /*alignment=*/expected_alignment());
FileDataLoader::from(program_path(), /*alignment=*/expected_alignment());
ASSERT_EQ(loader.error(), Error::Ok);

// Wrap the real loader in a spy so we can see which operations were
Expand Down
2 changes: 1 addition & 1 deletion runtime/executor/test/execution_plan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ExecutionPlanTest : public ::testing::Test {
void SetUp() override {
// Create a loader for the serialized ModuleAdd program.
const char* path = std::getenv("ET_MODULE_ADD_PATH");
Result<FileDataLoader> loader = FileDataLoader::From(path);
Result<FileDataLoader> loader = FileDataLoader::from(path);
ASSERT_EQ(loader.error(), Error::Ok);
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));

Expand Down
2 changes: 1 addition & 1 deletion runtime/executor/test/kernel_integration_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class KernelIntegrationTest : public ::testing::Test {

// Create a loader for the serialized ModuleAdd program.
const char* path = std::getenv("ET_MODULE_ADD_PATH");
Result<FileDataLoader> loader = FileDataLoader::From(path);
Result<FileDataLoader> loader = FileDataLoader::from(path);
ASSERT_EQ(loader.error(), Error::Ok);
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));

Expand Down
2 changes: 1 addition & 1 deletion runtime/executor/test/kernel_resolution_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class KernelResolutionTest : public ::testing::Test {

// Create a loader for the serialized ModuleAdd program.
const char* path = std::getenv("ET_MODULE_ADD_PATH");
Result<FileDataLoader> loader = FileDataLoader::From(path);
Result<FileDataLoader> loader = FileDataLoader::from(path);
ASSERT_EQ(loader.error(), Error::Ok);
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));

Expand Down
2 changes: 1 addition & 1 deletion runtime/executor/test/method_meta_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MethodMetaTest : public ::testing::Test {
void SetUp() override {
// Create a loader for the serialized ModuleAdd program.
const char* path = std::getenv("ET_MODULE_ADD_PATH");
Result<FileDataLoader> loader = FileDataLoader::From(path);
Result<FileDataLoader> loader = FileDataLoader::from(path);
ASSERT_EQ(loader.error(), Error::Ok);
loader_ = std::make_unique<FileDataLoader>(std::move(loader.get()));

Expand Down
2 changes: 1 addition & 1 deletion runtime/executor/test/method_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MethodTest : public ::testing::Test {
protected:
void load_program(const char* path, const char* module_name) {
// Create a loader for the serialized program.
Result<FileDataLoader> loader = FileDataLoader::From(path);
Result<FileDataLoader> loader = FileDataLoader::from(path);
ASSERT_EQ(loader.error(), Error::Ok);
loaders_.insert(
{module_name,
Expand Down
4 changes: 2 additions & 2 deletions runtime/executor/test/program_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ProgramTest : public ::testing::Test {

// Load the serialized ModuleAdd data.
const char* path = std::getenv("ET_MODULE_ADD_PATH");
Result<FileDataLoader> loader = FileDataLoader::From(path);
Result<FileDataLoader> loader = FileDataLoader::from(path);
ASSERT_EQ(loader.error(), Error::Ok);

// This file should always be compatible.
Expand All @@ -59,7 +59,7 @@ class ProgramTest : public ::testing::Test {

// Load the serialized ModuleAdd data.
path = std::getenv("ET_MODULE_MULTI_ENTRY_PATH");
Result<FileDataLoader> multi_loader = FileDataLoader::From(path);
Result<FileDataLoader> multi_loader = FileDataLoader::from(path);
ASSERT_EQ(multi_loader.error(), Error::Ok);

// This file should always be compatible.
Expand Down
2 changes: 1 addition & 1 deletion sdk/runners/executor_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class ProgramData {
// Create a DataLoader that wraps the input file. It may be a plain Program,
// or it may be a BundledProgram that contains a Program.
Result<util::FileDataLoader> loader =
util::FileDataLoader::From(filename.c_str());
util::FileDataLoader::from(filename.c_str());
ET_CHECK_MSG(
loader.ok(),
"Could not create loader for file '%s': 0x%x",
Expand Down
4 changes: 2 additions & 2 deletions test/size_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ int main(int argc, char** argv) {
&runtime_allocator,
&temp_allocator)};

Result<FileDataLoader> loader = FileDataLoader::From(argv[1]);
Result<FileDataLoader> loader = FileDataLoader::from(argv[1]);
ET_CHECK_MSG(
loader.ok(), "FileDataLoader::From() failed: 0x%" PRIx32, loader.error());
loader.ok(), "FileDataLoader::from() failed: 0x%" PRIx32, loader.error());

uint32_t prof_tok = EXECUTORCH_BEGIN_PROF("de-serialize model");
const auto program = Program::Load(&loader.get());
Expand Down