-
Notifications
You must be signed in to change notification settings - Fork 418
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[executorch][core] NamedDataMap interface
Add NamedDataMap interface to runtime. Differential Revision: [D66834552](https://our.internmc.facebook.com/intern/diff/D66834552/) [ghstack-poisoned]
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <executorch/runtime/core/exec_aten/exec_aten.h> | ||
#include <executorch/runtime/core/freeable_buffer.h> | ||
#include <executorch/runtime/core/result.h> | ||
#include <executorch/runtime/core/span.h> | ||
#include <executorch/runtime/core/tensor_layout.h> | ||
#include <executorch/runtime/platform/compiler.h> | ||
|
||
namespace executorch { | ||
namespace runtime { | ||
|
||
/** | ||
* Interface to access and retrieve data via name from a loaded data file. | ||
* See executorch/extension/flat_tensor/ for an example. | ||
*/ | ||
class NamedDataMap { | ||
public: | ||
virtual ~NamedDataMap() = default; | ||
/** | ||
* Get tensor metadata by fully qualified name (FQN). | ||
* | ||
* @param fqn Fully qualified name of the tensor. | ||
* @return Result containing a pointer to the metadata. | ||
*/ | ||
ET_NODISCARD virtual Result<const executorch::runtime::TensorLayout> | ||
get_metadata(const char* fqn) const = 0; | ||
/** | ||
* Get tensor data by fully qualified name (FQN). | ||
* | ||
* @param fqn Fully qualified name of the tensor. | ||
* @return Result containing a span of uint8_t representing the tensor data. | ||
*/ | ||
ET_NODISCARD virtual Result<Span<const uint8_t>> get_data( | ||
const char* fqn) const = 0; | ||
}; | ||
|
||
} // namespace runtime | ||
} // namespace executorch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters