@isidorus/cpu 0.0.0-alpha.0 → 0.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -47
- package/binding.gyp +115 -102
- package/dist/_native.d.ts.map +1 -0
- package/dist/_native.js.map +1 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/inference-pool.d.ts.map +1 -0
- package/dist/inference-pool.js.map +1 -0
- package/dist/install-libtensorflow.d.ts.map +1 -0
- package/dist/{ts/install-libtensorflow.js → install-libtensorflow.js} +6 -6
- package/dist/install-libtensorflow.js.map +1 -0
- package/dist/ops/array_ops.d.ts.map +1 -0
- package/dist/ops/array_ops.js.map +1 -0
- package/dist/ops/index.d.ts.map +1 -0
- package/dist/ops/index.js.map +1 -0
- package/dist/ops/math_ops.d.ts.map +1 -0
- package/dist/ops/math_ops.js.map +1 -0
- package/dist/ops/nn_ops.d.ts.map +1 -0
- package/dist/ops/nn_ops.js.map +1 -0
- package/dist/ops/variable_ops.d.ts.map +1 -0
- package/dist/ops/variable_ops.js.map +1 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -63
- package/scripts/install.js +100 -100
- package/scripts/test-install.js +82 -82
- package/scripts/test.js +45 -45
- package/src/native/addon.cc +11 -11
- package/src/native/graph.cc +442 -442
- package/src/native/graph.h +51 -51
- package/src/native/platform_tf.h +7 -7
- package/src/native/session.cc +796 -715
- package/src/native/session.h +91 -91
- package/dist/ts/_native.d.ts.map +0 -1
- package/dist/ts/_native.js.map +0 -1
- package/dist/ts/graph.d.ts.map +0 -1
- package/dist/ts/graph.js.map +0 -1
- package/dist/ts/index.d.ts.map +0 -1
- package/dist/ts/index.js.map +0 -1
- package/dist/ts/inference-pool.d.ts.map +0 -1
- package/dist/ts/inference-pool.js.map +0 -1
- package/dist/ts/inference_pool.d.ts +0 -99
- package/dist/ts/inference_pool.d.ts.map +0 -1
- package/dist/ts/inference_pool.js +0 -370
- package/dist/ts/inference_pool.js.map +0 -1
- package/dist/ts/install-libtensorflow.d.ts.map +0 -1
- package/dist/ts/install-libtensorflow.js.map +0 -1
- package/dist/ts/ops/array_ops.d.ts.map +0 -1
- package/dist/ts/ops/array_ops.js.map +0 -1
- package/dist/ts/ops/index.d.ts.map +0 -1
- package/dist/ts/ops/index.js.map +0 -1
- package/dist/ts/ops/math_ops.d.ts.map +0 -1
- package/dist/ts/ops/math_ops.js.map +0 -1
- package/dist/ts/ops/nn_ops.d.ts.map +0 -1
- package/dist/ts/ops/nn_ops.js.map +0 -1
- package/dist/ts/ops/variable_ops.d.ts.map +0 -1
- package/dist/ts/ops/variable_ops.js.map +0 -1
- package/dist/ts/session.d.ts.map +0 -1
- package/dist/ts/session.js.map +0 -1
- /package/dist/{ts/_native.d.ts → _native.d.ts} +0 -0
- /package/dist/{ts/_native.js → _native.js} +0 -0
- /package/dist/{ts/graph.d.ts → graph.d.ts} +0 -0
- /package/dist/{ts/graph.js → graph.js} +0 -0
- /package/dist/{ts/index.d.ts → index.d.ts} +0 -0
- /package/dist/{ts/index.js → index.js} +0 -0
- /package/dist/{ts/inference-pool.d.ts → inference-pool.d.ts} +0 -0
- /package/dist/{ts/inference-pool.js → inference-pool.js} +0 -0
- /package/dist/{ts/install-libtensorflow.d.ts → install-libtensorflow.d.ts} +0 -0
- /package/dist/{ts/ops → ops}/array_ops.d.ts +0 -0
- /package/dist/{ts/ops → ops}/array_ops.js +0 -0
- /package/dist/{ts/ops → ops}/index.d.ts +0 -0
- /package/dist/{ts/ops → ops}/index.js +0 -0
- /package/dist/{ts/ops → ops}/math_ops.d.ts +0 -0
- /package/dist/{ts/ops → ops}/math_ops.js +0 -0
- /package/dist/{ts/ops → ops}/nn_ops.d.ts +0 -0
- /package/dist/{ts/ops → ops}/nn_ops.js +0 -0
- /package/dist/{ts/ops → ops}/variable_ops.d.ts +0 -0
- /package/dist/{ts/ops → ops}/variable_ops.js +0 -0
- /package/dist/{ts/session.d.ts → session.d.ts} +0 -0
- /package/dist/{ts/session.js → session.js} +0 -0
package/src/native/graph.h
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include <napi.h>
|
|
3
|
-
#include <string>
|
|
4
|
-
#include <vector>
|
|
5
|
-
#include "platform_tf.h"
|
|
6
|
-
|
|
7
|
-
#ifndef ISIDORUS_STATUS_GUARD_DEFINED
|
|
8
|
-
#define ISIDORUS_STATUS_GUARD_DEFINED
|
|
9
|
-
struct StatusGuard
|
|
10
|
-
{
|
|
11
|
-
TF_Status *s;
|
|
12
|
-
StatusGuard() : s(TF_NewStatus()) {}
|
|
13
|
-
~StatusGuard() { TF_DeleteStatus(s); }
|
|
14
|
-
bool ok() const { return TF_GetCode(s) == TF_OK; }
|
|
15
|
-
std::string message() const { return TF_Message(s); }
|
|
16
|
-
};
|
|
17
|
-
#endif
|
|
18
|
-
|
|
19
|
-
class GraphWrap : public Napi::ObjectWrap<GraphWrap>
|
|
20
|
-
{
|
|
21
|
-
public:
|
|
22
|
-
static Napi::Object Init(Napi::Env env, Napi::Object exports);
|
|
23
|
-
|
|
24
|
-
explicit GraphWrap(const Napi::CallbackInfo &info);
|
|
25
|
-
~GraphWrap();
|
|
26
|
-
|
|
27
|
-
// Expose the raw graph pointer to Session and op helpers.
|
|
28
|
-
TF_Graph *GetGraph() const { return graph_; }
|
|
29
|
-
|
|
30
|
-
private:
|
|
31
|
-
TF_Graph *graph_ = nullptr;
|
|
32
|
-
int op_counter_ = 0;
|
|
33
|
-
|
|
34
|
-
Napi::Value AddOp(const Napi::CallbackInfo &info);
|
|
35
|
-
Napi::Value HasOp(const Napi::CallbackInfo &info);
|
|
36
|
-
Napi::Value OpOutputType(const Napi::CallbackInfo &info);
|
|
37
|
-
Napi::Value OpOutputShape(const Napi::CallbackInfo &info);
|
|
38
|
-
Napi::Value ToGraphDef(const Napi::CallbackInfo &info);
|
|
39
|
-
Napi::Value NumOps(const Napi::CallbackInfo &info);
|
|
40
|
-
|
|
41
|
-
// ── Frozen graph import ─────────────────────────────────────────────────
|
|
42
|
-
// importGraphDef(buffer: Buffer): void
|
|
43
|
-
//
|
|
44
|
-
// Deserialises a binary GraphDef proto (e.g. a frozen .pb file) into
|
|
45
|
-
// this graph. The graph must be empty — importing into a non-empty graph
|
|
46
|
-
// causes op name conflicts.
|
|
47
|
-
//
|
|
48
|
-
// Used by InferencePool's tf-parallel path to load frozen models via the
|
|
49
|
-
// native Session (with ConfigProto thread config + affinity fence) rather
|
|
50
|
-
// than through jude-tf.
|
|
51
|
-
Napi::Value ImportGraphDef(const Napi::CallbackInfo &info);
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <napi.h>
|
|
3
|
+
#include <string>
|
|
4
|
+
#include <vector>
|
|
5
|
+
#include "platform_tf.h"
|
|
6
|
+
|
|
7
|
+
#ifndef ISIDORUS_STATUS_GUARD_DEFINED
|
|
8
|
+
#define ISIDORUS_STATUS_GUARD_DEFINED
|
|
9
|
+
struct StatusGuard
|
|
10
|
+
{
|
|
11
|
+
TF_Status *s;
|
|
12
|
+
StatusGuard() : s(TF_NewStatus()) {}
|
|
13
|
+
~StatusGuard() { TF_DeleteStatus(s); }
|
|
14
|
+
bool ok() const { return TF_GetCode(s) == TF_OK; }
|
|
15
|
+
std::string message() const { return TF_Message(s); }
|
|
16
|
+
};
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
class GraphWrap : public Napi::ObjectWrap<GraphWrap>
|
|
20
|
+
{
|
|
21
|
+
public:
|
|
22
|
+
static Napi::Object Init(Napi::Env env, Napi::Object exports);
|
|
23
|
+
|
|
24
|
+
explicit GraphWrap(const Napi::CallbackInfo &info);
|
|
25
|
+
~GraphWrap();
|
|
26
|
+
|
|
27
|
+
// Expose the raw graph pointer to Session and op helpers.
|
|
28
|
+
TF_Graph *GetGraph() const { return graph_; }
|
|
29
|
+
|
|
30
|
+
private:
|
|
31
|
+
TF_Graph *graph_ = nullptr;
|
|
32
|
+
int op_counter_ = 0;
|
|
33
|
+
|
|
34
|
+
Napi::Value AddOp(const Napi::CallbackInfo &info);
|
|
35
|
+
Napi::Value HasOp(const Napi::CallbackInfo &info);
|
|
36
|
+
Napi::Value OpOutputType(const Napi::CallbackInfo &info);
|
|
37
|
+
Napi::Value OpOutputShape(const Napi::CallbackInfo &info);
|
|
38
|
+
Napi::Value ToGraphDef(const Napi::CallbackInfo &info);
|
|
39
|
+
Napi::Value NumOps(const Napi::CallbackInfo &info);
|
|
40
|
+
|
|
41
|
+
// ── Frozen graph import ─────────────────────────────────────────────────
|
|
42
|
+
// importGraphDef(buffer: Buffer): void
|
|
43
|
+
//
|
|
44
|
+
// Deserialises a binary GraphDef proto (e.g. a frozen .pb file) into
|
|
45
|
+
// this graph. The graph must be empty — importing into a non-empty graph
|
|
46
|
+
// causes op name conflicts.
|
|
47
|
+
//
|
|
48
|
+
// Used by InferencePool's tf-parallel path to load frozen models via the
|
|
49
|
+
// native Session (with ConfigProto thread config + affinity fence) rather
|
|
50
|
+
// than through jude-tf.
|
|
51
|
+
Napi::Value ImportGraphDef(const Napi::CallbackInfo &info);
|
|
52
52
|
};
|
package/src/native/platform_tf.h
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include "tensorflow/c/c_api.h"
|
|
3
|
-
|
|
4
|
-
#if defined(TF_MAJOR_VERSION)
|
|
5
|
-
#if TF_MAJOR_VERSION < 2
|
|
6
|
-
#error "isidorus requires TensorFlow 2.x or higher."
|
|
7
|
-
#endif
|
|
1
|
+
#pragma once
|
|
2
|
+
#include "tensorflow/c/c_api.h"
|
|
3
|
+
|
|
4
|
+
#if defined(TF_MAJOR_VERSION)
|
|
5
|
+
#if TF_MAJOR_VERSION < 2
|
|
6
|
+
#error "isidorus requires TensorFlow 2.x or higher."
|
|
7
|
+
#endif
|
|
8
8
|
#endif
|