增加MNN模型支持
This commit is contained in:
@ -6,8 +6,7 @@
|
||||
#include <napi.h>
|
||||
|
||||
#define NODE_INIT_OBJECT(name, function) \
|
||||
do \
|
||||
{ \
|
||||
do { \
|
||||
auto obj = Napi::Object::New(env); \
|
||||
function(env, obj); \
|
||||
exports.Set(Napi::String::New(env, #name), obj); \
|
||||
@ -21,4 +20,13 @@ inline uint64_t __node_ptr_of__(Napi::Value value)
|
||||
|
||||
#define NODE_PTR_OF(type, value) (reinterpret_cast<type *>(__node_ptr_of__(value)))
|
||||
|
||||
|
||||
inline void *dataFromTypedArray(const Napi::Value &val, size_t &bytes)
|
||||
{
|
||||
auto arr = val.As<Napi::TypedArray>();
|
||||
auto data = static_cast<uint8_t *>(arr.ArrayBuffer().Data());
|
||||
bytes = arr.ByteLength();
|
||||
return static_cast<void *>(data + arr.ByteOffset());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
18
cxx/common/tensor.h
Normal file
18
cxx/common/tensor.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef __COMMON_TENSOR_H__
|
||||
#define __COMMON_TENSOR_H__
|
||||
|
||||
enum class TensorDataType {
|
||||
Unknown,
|
||||
Float32,
|
||||
Float64,
|
||||
Int32,
|
||||
Uint32,
|
||||
Int16,
|
||||
Uint16,
|
||||
Int8,
|
||||
Uint8,
|
||||
Int64,
|
||||
Uint64,
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user