File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #pragma once
10
+
11
+ #include < executorch/runtime/core/exec_aten/exec_aten.h>
12
+ #include < executorch/runtime/core/freeable_buffer.h>
13
+ #include < executorch/runtime/core/result.h>
14
+ #include < executorch/runtime/core/span.h>
15
+ #include < executorch/runtime/core/tensor_layout.h>
16
+ #include < executorch/runtime/platform/compiler.h>
17
+
18
+ namespace executorch {
19
+ namespace runtime {
20
+
21
+ /* *
22
+ * Interface to access and retrieve data via name from a loaded data file.
23
+ * See executorch/extension/flat_tensor/ for an example.
24
+ */
25
+ class NamedDataMap {
26
+ public:
27
+ virtual ~NamedDataMap () = default ;
28
+ /* *
29
+ * Get tensor metadata by fully qualified name (FQN).
30
+ *
31
+ * @param fqn Fully qualified name of the tensor.
32
+ * @return Result containing a pointer to the metadata.
33
+ */
34
+ ET_NODISCARD virtual Result<const executorch::runtime::TensorLayout>
35
+ get_metadata (const char * fqn) const = 0 ;
36
+ /* *
37
+ * Get tensor data by fully qualified name (FQN).
38
+ *
39
+ * @param fqn Fully qualified name of the tensor.
40
+ * @return Result containing a span of uint8_t representing the tensor data.
41
+ */
42
+ ET_NODISCARD virtual Result<Span<const uint8_t >> get_data (
43
+ const char * fqn) const = 0;
44
+ };
45
+
46
+ } // namespace runtime
47
+ } // namespace executorch
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ def define_common_targets():
32
32
"data_loader.h" ,
33
33
"error.h" ,
34
34
"freeable_buffer.h" ,
35
+ "named_data_map.h" ,
35
36
"result.h" ,
36
37
"span.h" ,
37
38
"tensor_layout.h" ,
You can’t perform that action at this time.
0 commit comments