You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Path to external tensor data file (.ptd format). Optional.");
53
58
DEFINE_uint32(num_executions, 1, "Number of times to run the model.");
54
59
#ifdef ET_EVENT_TRACER_ENABLED
55
60
DEFINE_string(etdump_path, "model.etdump", "Write ETDump data to this path.");
@@ -60,6 +65,7 @@ DEFINE_int32(
60
65
"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.");
61
66
62
67
using executorch::extension::FileDataLoader;
68
+
using executorch::extension::FlatTensorDataMap;
63
69
using executorch::runtime::Error;
64
70
using executorch::runtime::EValue;
65
71
using executorch::runtime::EventTracer;
@@ -242,8 +248,43 @@ int main(int argc, char** argv) {
242
248
// be used by a single thread at at time, but it can be reused.
243
249
//
244
250
EventTraceManager tracer;
251
+
252
+
// Handle optional external tensor data loading
253
+
std::unique_ptr<FileDataLoader> data_loader;
254
+
std::unique_ptr<FlatTensorDataMap> data_map;
255
+
256
+
if (!FLAGS_data_path.empty()) {
257
+
ET_LOG(
258
+
Info, "Loading external tensor data from %s", FLAGS_data_path.c_str());
259
+
260
+
// Create FileDataLoader for the PTD file
261
+
Result<FileDataLoader> data_loader_result =
262
+
FileDataLoader::from(FLAGS_data_path.c_str());
263
+
ET_CHECK_MSG(
264
+
data_loader_result.ok(),
265
+
"Failed to create FileDataLoader for data path %s: 0x%" PRIx32,
0 commit comments