|
5 | 5 |
|
6 | 6 | #include <executorch/runtime/core/exec_aten/util/scalar_type_util.h> |
7 | 7 | #include <jsi/jsi.h> |
| 8 | +#include <rnexecutorch/Log.h> |
| 9 | +#include <rnexecutorch/jsi/OwningArrayBuffer.h> |
8 | 10 | #include <rnexecutorch/utils/JsiTensorView.h> |
9 | 11 |
|
10 | 12 | namespace rnexecutorch::jsiconversion { |
@@ -104,7 +106,7 @@ inline JsiTensorView getValue<JsiTensorView>(const jsi::Value &val, |
104 | 106 | throw jsi::JSError(runtime, "Data must be an ArrayBuffer or TypedArray"); |
105 | 107 | } |
106 | 108 | } |
107 | | - return std::move(tensorView); |
| 109 | + return tensorView; |
108 | 110 | } |
109 | 111 |
|
110 | 112 | template <> |
@@ -181,6 +183,17 @@ inline jsi::Value getJsiValue(int val, jsi::Runtime &runtime) { |
181 | 183 | return jsi::Value(runtime, val); |
182 | 184 | } |
183 | 185 |
|
| 186 | +inline jsi::Value |
| 187 | +getJsiValue(const std::vector<std::shared_ptr<OwningArrayBuffer>> &vec, |
| 188 | + jsi::Runtime &runtime) { |
| 189 | + jsi::Array array(runtime, vec.size()); |
| 190 | + for (size_t i = 0; i < vec.size(); i++) { |
| 191 | + jsi::ArrayBuffer arrayBuffer(runtime, vec[i]); |
| 192 | + array.setValueAtIndex(runtime, i, jsi::Value(runtime, arrayBuffer)); |
| 193 | + } |
| 194 | + return jsi::Value(runtime, array); |
| 195 | +} |
| 196 | + |
184 | 197 | inline jsi::Value getJsiValue(const std::string &str, jsi::Runtime &runtime) { |
185 | 198 | return jsi::String::createFromAscii(runtime, str); |
186 | 199 | } |
|
0 commit comments