Skip to content

Commit 65de731

Browse files
pytorchbotdbort
andauthored
Remove stray uses of torch::executor:: from examples/... (#5558)
Remove stray uses of `torch::executor::` from examples/... (#5512) Summary: Example code should use the new `executorch::` namespace wherever possible, and should not define code under the `torch::` namespace. Pull Request resolved: #5512 Test Plan: - Built llava changes with `bash .ci/scripts/test_llava.sh` Reviewed By: JacobSzwejbka, larryliu0820 Differential Revision: D63133181 Pulled By: dbort fbshipit-source-id: 5796b85eef053f3b3e4ba0e27a3a26ae48747b5a (cherry picked from commit abe9c36) Co-authored-by: Dave Bort <[email protected]>
1 parent 14b3ee3 commit 65de731

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

examples/devtools/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Once an `ETDump` has been generated, it can be viewed using the CLI inspector. T
6464
ETDump profiling can also be used in a custom C++ program. `ETDumpGen` is an implementation of the abstract `EventTracer` class. Include the header file located at `devtools/etdump/etdump_flatcc.h`. To initialize the ETDump generator, construct it before loading the method from the program.
6565

6666
```cpp
67-
torch::executor::ETDumpGen etdump_gen = torch::executor::ETDumpGen();
67+
executorch::etdump::ETDumpGen etdump_gen;
6868
Result<Method> method =
6969
program->load_method(method_name, &memory_manager, &etdump_gen);
7070
```

examples/models/llava/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ DEFINE_int32(
4848
-1,
4949
"Number of CPU threads for inference. Defaults to -1, which implies we'll use a heuristic to derive the # of performant cores for a specific device.");
5050

51+
using executorch::extension::llm::Image;
52+
5153
int32_t main(int32_t argc, char** argv) {
5254
gflags::ParseCommandLineFlags(&argc, &argv, true);
5355

@@ -90,7 +92,7 @@ int32_t main(int32_t argc, char** argv) {
9092
image_data.resize(3 * 240 * 336);
9193
std::fill(image_data.begin(), image_data.end(), 0); // black
9294
std::array<int32_t, 3> image_shape = {3, 240, 336};
93-
std::vector<torch::executor::Image> images = {
95+
std::vector<Image> images = {
9496
{.data = image_data, .width = image_shape[2], .height = image_shape[1]}};
9597
#else // LLAVA_NO_TORCH_DUMMY_IMAGE
9698
// cv::Mat image = cv::imread(image_path, cv::IMREAD_COLOR);
@@ -111,7 +113,7 @@ int32_t main(int32_t argc, char** argv) {
111113
image_data.assign(
112114
image_tensor.data_ptr<uint8_t>(),
113115
image_tensor.data_ptr<uint8_t>() + image_tensor.numel());
114-
std::vector<torch::executor::Image> images = {
116+
std::vector<Image> images = {
115117
{.data = image_data,
116118
.width = static_cast<int32_t>(image_tensor.size(2)),
117119
.height = static_cast<int32_t>(image_tensor.size(1))}};

0 commit comments

Comments
 (0)