@dxo/nn 0.0.0 → 0.0.4

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.
Files changed (2) hide show
  1. package/README.md +35 -1
  2. package/package.json +36 -8
package/README.md CHANGED
@@ -1,3 +1,37 @@
1
1
  # @dxo/nn
2
2
 
3
- Placeholder package (0.0.0). Reserved for the DXO project.
3
+ **Developer preview — API unstable (`0.0.x`).**
4
+
5
+ Pure TypeScript modules over `@dxo/core`.
6
+
7
+ ## Contract (G3 preview)
8
+
9
+ | Type | Behavior |
10
+ |------|----------|
11
+ | `Linear(in, out)` | **`y = x @ W + b` only** — no implicit ReLU |
12
+ | `Relu` / `relu(x)` | Explicit nonlinearity |
13
+ | `Sequential(layers)` | Chains `forward` |
14
+ | `parameters()` | Collects `Tensor` fields (and nested modules) in enumeration order |
15
+ | `zeroGrad()` | Calls `zeroGrad` on each parameter leaf |
16
+ | `Linear.loadParameters([W, b])` | Reassign leaves after `optimizer.step` |
17
+ | `Linear.state` / `loadState` | Plain `{ shape, data }` snapshots |
18
+
19
+ ```typescript
20
+ import { Linear, Relu, Sequential } from '@dxo/nn';
21
+ import { SGD } from '@dxo/optimizer';
22
+
23
+ const model = new Sequential([new Linear(2, 4), new Relu(), new Linear(4, 1)]);
24
+ const opt = new SGD(0.05);
25
+ // ... loss.backward()
26
+ model.layers[0] // update Linear leaves via loadParameters after step
27
+ ```
28
+
29
+ Training step pattern:
30
+
31
+ ```typescript
32
+ model.zeroGrad();
33
+ const loss = /* scalar Tensor */;
34
+ loss.backward();
35
+ const linear = model.layers[0] as Linear;
36
+ linear.loadParameters(opt.step(linear.parameters()));
37
+ ```
package/package.json CHANGED
@@ -1,10 +1,38 @@
1
1
  {
2
- "name": "@dxo/nn",
3
- "version": "0.0.0",
4
- "description": "DXO placeholder — not for production use.",
5
- "license": "MIT",
6
- "private": false,
7
- "files": [
8
- "README.md"
9
- ]
2
+ "name": "@dxo/nn",
3
+ "version": "0.0.4",
4
+ "type": "module",
5
+ "description": "DXO neural modules over @dxo/core (developer preview, API unstable)",
6
+ "license": "MIT OR Apache-2.0",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "test:forward": "tsx ../../../scripts/test/nn-forward.ts"
22
+ },
23
+ "dependencies": {
24
+ "@dxo/core": "0.0.4"
25
+ },
26
+ "keywords": [
27
+ "dxo",
28
+ "neural-network",
29
+ "typescript"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/ai4waifu/dxo-framework.git"
37
+ }
10
38
  }