Skip to content

Commit f6ba0bd

Browse files
author
zhenyanzhang
committed
Update on "[ExecuTorch][#10375] Add extension.BundledModule to Wrap extension.Module with Bundled Program Logic"
#10375 # Context This issue is a step of #9638. In #9638, we want to have `extension.Module` as the single source of implementation in `pybindings`, which means that `pybindings.PyModule` should use `extension.Module` rather than its own `pybindings.Module`. The issue is that `pybindings.PyModule` is dependent on the `method` getter from `pybindings.Module`, which `extension.Module` do not have. Since we don't want to expose `method` getter in `extension.Module`, we have to protect the getter, wrap the functions that is dependent on it and use the protected getter there, ultimately decouple `pybindings` from a `method` getter. # Proposal Now that we have a protected `method` getter, we can introduce a `extension.BundledModule`, a child class inheriting `extension.Module` which wraps up bundled program logic that is dependent on the `method` getter. Differential Revision: [D73564125](https://our.internmc.facebook.com/intern/diff/D73564125/) [ghstack-poisoned]
1 parent 5feb8d5 commit f6ba0bd

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

extension/module/module.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -531,18 +531,17 @@ class BundledModule : public Module {
531531
BundledModule& operator=(BundledModule&&) = delete;
532532

533533
/**
534-
* Execute a specific method with the input value at the given testset_idx
535-
* from the program bundle.
534+
* Load a specific method with the input value at the given `testset_idx` from
535+
* the bundle to the method.
536536
*
537-
* Before execution, this function loads the program and method with
538-
* load_bundled_input in bundled_program.
537+
* This function is a wrapper of `load_bundled_input` in `bundled_program`.
539538
*
540539
* @param[in] method_name The name of the method to execute.
541-
* @param[in] testset_idx The index of the input value to be passed to
542-
* the method.
540+
* @param[in] testset_idx The index of the input value to be passed to the
541+
* method.
543542
*
544-
* @returns A Result object containing either a vector of output values
545-
* from the method or an error to indicate failure.
543+
* @returns Return Error::Ok on a successful load, or the error happens during
544+
* execution.
546545
*/
547546
ET_NODISCARD
548547
runtime::Error load_bundled_input(
@@ -551,9 +550,9 @@ class BundledModule : public Module {
551550

552551
/**
553552
* Verify the output of a specific method with the expected output from the
554-
* program bundle at the given testset_idx.
553+
* program bundle at the given `testset_idx`.
555554
*
556-
* This function is a wrapper of verify_method_outputs in bundled_program.
555+
* This function is a wrapper of `verify_method_outputs` in `bundled_program`.
557556
*
558557
* @param[in] method_name The name of the method to extract outputs from.
559558
* @param[in] testset_idx The index of expected output needs to be compared.

0 commit comments

Comments
 (0)