@@ -46,28 +46,30 @@ class ET_EXPERIMENTAL NamedDataMap {
4646 * Loads data corresponding to the fqn into the provided buffer.
4747 *
4848 * @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.
5051 * @param buffer The buffer to load the data into. Must point to at least
5152 * `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 .
5354 */
54- ET_NODISCARD virtual Error
55+ ET_NODISCARD virtual Result< size_t >
5556 load_data_into (const char * fqn, size_t size, void * buffer) const = 0 ;
5657
5758 /* *
5859 * Get the number of keys in the NamedDataMap.
5960 *
6061 * @return Result containing the number of keys.
6162 */
62- ET_NODISCARD virtual Result<int > get_num_keys () const = 0;
63+ ET_NODISCARD virtual Result<size_t > get_num_keys () const = 0;
6364
6465 /* *
6566 * Get the key at the given index.
6667 *
6768 * @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.
6971 */
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;
7173};
7274
7375} // namespace runtime
0 commit comments