Skip to content

Commit bf24bbd

Browse files
committed
chore: 🧹✨
1 parent 53fbf61 commit bf24bbd

3 files changed

Lines changed: 36 additions & 3 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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

‎packages/react-native-executorch/common/rnexecutorch/bindings/ExecutorchModule.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
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

‎packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ template <typename Model> class ModelHostObject : public JsiHostObject {
1919
public:
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"));

0 commit comments

Comments
 (0)