mini-jstorch 1.4.5 → 1.6.0

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.
@@ -1,23 +0,0 @@
1
- // Example: Test learning rate schedulers (StepLR and LambdaLR) with mini-jstorch optimizers
2
-
3
- import { SGD, StepLR, LambdaLR, Tensor } from "../src/MainEngine.js";
4
-
5
- const param = { param: [[1, 2], [3, 4]], grad: [[0, 0], [0, 0]] };
6
- const optimizer = new SGD([param], 0.1);
7
-
8
- // --- Test StepLR ---
9
- console.log("Testing StepLR...");
10
- const stepScheduler = new StepLR(optimizer, 3, 0.5);
11
- for (let epoch = 1; epoch <= 10; epoch++) {
12
- stepScheduler.step();
13
- console.log(`Epoch ${epoch}: LR = ${optimizer.lr.toFixed(4)}`);
14
- }
15
-
16
- // --- Test LambdaLR ---
17
- console.log("\nTesting LambdaLR...");
18
- optimizer.lr = 0.1; // Reset LR
19
- const lambdaScheduler = new LambdaLR(optimizer, epoch => 1.0 / (1 + epoch));
20
- for (let epoch = 1; epoch <= 5; epoch++) {
21
- lambdaScheduler.step();
22
- console.log(`Epoch ${epoch}: LR = ${optimizer.lr.toFixed(4)}`);
23
- }