@@ -46,28 +46,30 @@ class ET_EXPERIMENTAL NamedDataMap {
46
46
* Loads data corresponding to the fqn into the provided buffer.
47
47
*
48
48
* @param fqn Fully qualified name of the tensor.
49
- * @param size The number of bytes to load.
49
+ * @param size The number of bytes to load. Use `get_metadata` to retrieve the
50
+ * size of the tensor for a given fqn.
50
51
* @param buffer The buffer to load the data into. Must point to at least
51
52
* `size` bytes of memory.
52
- * @return An error code on if the load was successful .
53
+ * @return Result containing the number of bytes written on success .
53
54
*/
54
- ET_NODISCARD virtual Error
55
+ ET_NODISCARD virtual Result< size_t >
55
56
load_data_into (const char * fqn, size_t size, void * buffer) const = 0 ;
56
57
57
58
/* *
58
59
* Get the number of keys in the NamedDataMap.
59
60
*
60
61
* @return Result containing the number of keys.
61
62
*/
62
- ET_NODISCARD virtual Result<int > get_num_keys () const = 0;
63
+ ET_NODISCARD virtual Result<size_t > get_num_keys () const = 0;
63
64
64
65
/* *
65
66
* Get the key at the given index.
66
67
*
67
68
* @param index The index of the key to retrieve.
68
- * @return Result containing the key at the given index.
69
+ * @return Result containing the key at the given index. Note: the returned
70
+ * pointer is only valid for the lifetime of the DataMap.
69
71
*/
70
- ET_NODISCARD virtual Result<const char *> get_key (int index) const = 0;
72
+ ET_NODISCARD virtual Result<const char *> get_key (size_t index) const = 0;
71
73
};
72
74
73
75
} // namespace runtime
0 commit comments