File tree Expand file tree Collapse file tree
packages/react-native-executorch/common/rnexecutorch Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < concepts>
4+
5+ namespace rnexecutorch {
6+
7+ // When i make BaseModel have all of this methods we can then just check from
8+ // is_base_of instead of doing this for every single method
9+ template <typename T>
10+ concept HasForward = requires (T t) {
11+ { &T::forward };
12+ };
13+
14+ template <typename T>
15+ concept HasMethodNames = requires (T t) {
16+ { &T::methodNames };
17+ };
18+
19+ template <typename T>
20+ concept HasGetInputShape = requires (T t) {
21+ { &T::getInputShape };
22+ };
23+
24+ template <typename T>
25+ concept HasIsLoaded = requires (T t) {
26+ { &T::isLoaded };
27+ };
28+
29+ template <typename T>
30+ concept UnloadableExternalMemoryAware = requires (T t) {
31+ { t.unload () } -> std::same_as<void >;
32+ { t.getMemoryLowerBound () } -> std::same_as<std::size_t >;
33+ };
34+
35+ } // namespace rnexecutorch
Original file line number Diff line number Diff line change 44
55#include < ReactCommon/CallInvoker.h>
66#include < executorch/extension/module/module.h>
7- #include < filesystem>
8- #include < jsi/jsi.h>
97#include < rnexecutorch/jsi/OwningArrayBuffer.h>
108#include < rnexecutorch/utils/JsiTensorView.h>
119
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ template <typename Model> class ModelHostObject : public JsiHostObject {
1919public:
2020 explicit ModelHostObject (const std::shared_ptr<Model> &model,
2121 std::shared_ptr<react::CallInvoker> callInvoker)
22- : JsiHostObject(), model(model), callInvoker(callInvoker) {
22+ : model(model), callInvoker(callInvoker) {
2323 if constexpr (UnloadableExternalMemoryAware<Model>) {
2424 addFunctions (
2525 JSI_EXPORT_FUNCTION (ModelHostObject<Model>, unload, " unload" ));
You can’t perform that action at this time.
0 commit comments