Skip to content

Commit 4728494

Browse files
JacobSzwejbkafacebook-github-bot
authored andcommitted
flag a bunch of method functions as deprecated (#523)
Summary: None of these should exist in the public API, but we are out of time before MVP so just deprecating Differential Revision: D49747135
1 parent 22354c8 commit 4728494

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

runtime/executor/method.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,10 @@ Error Method::execute() {
11001100
return experimental_reset_execution();
11011101
}
11021102

1103+
Result<MethodMeta> Method::method_meta() const {
1104+
return program_->method_meta(serialization_plan_->name()->c_str());
1105+
}
1106+
11031107
size_t Method::values_size() const {
11041108
return n_value_;
11051109
}

runtime/executor/method.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <executorch/runtime/core/event_tracer.h>
1313
#include <executorch/runtime/core/exec_aten/exec_aten.h>
1414
#include <executorch/runtime/executor/memory_manager.h>
15+
#include <executorch/runtime/executor/method_meta.h>
1516
#include <executorch/runtime/platform/compiler.h>
1617

1718
// Forward declare flatbuffer types. This is a public header and must not
@@ -196,17 +197,32 @@ class Method final {
196197
*/
197198
__ET_NODISCARD Error experimental_reset_execution();
198199

199-
size_t values_size() const;
200-
const EValue& get_value(size_t i) const;
201-
EValue& mutable_value(size_t i);
200+
/**
201+
* Gathers metadata for the named method.
202+
*
203+
* @returns the MethodMeta that corresponds to the calling Method.
204+
*/
205+
Result<MethodMeta> method_meta() const;
206+
207+
__ET_DEPRECATED size_t values_size() const;
208+
__ET_DEPRECATED const EValue& get_value(size_t i) const;
209+
__ET_DEPRECATED EValue& mutable_value(size_t i);
202210
size_t inputs_size() const;
203-
size_t get_input_index(size_t i) const;
204-
const EValue& get_input(size_t i) const;
205-
EValue& mutable_input(size_t i);
211+
/// DEPRECATED: Use MethodMeta instead to access metadata, and set_input to
212+
/// update Method inputs.
213+
__ET_DEPRECATED size_t get_input_index(size_t i) const;
214+
/// DEPRECATED: Use MethodMeta instead to access metadata, and set_input to
215+
/// update Method inputs.
216+
__ET_DEPRECATED const EValue& get_input(size_t i) const;
217+
/// DEPRECATED: Use MethodMeta instead to access metadata, and set_input to
218+
/// update Method inputs.
219+
__ET_DEPRECATED EValue& mutable_input(size_t i);
206220
size_t outputs_size() const;
207-
size_t get_output_index(size_t i) const;
221+
__ET_DEPRECATED size_t get_output_index(size_t i) const;
208222
const EValue& get_output(size_t i) const;
209-
EValue& mutable_output(size_t i);
223+
/// DEPRECATED: Use MethodMeta instead to access metadata, and get_output to
224+
/// retrieve Method outputs.
225+
__ET_DEPRECATED EValue& mutable_output(size_t i);
210226
~Method();
211227

212228
private:

0 commit comments

Comments
 (0)