catniff 0.1.9 → 0.1.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Catniff
2
2
 
3
- Catniff is a small and experimental tensor library and autograd engine inspired by [micrograd](https://github.com/karpathy/micrograd). The name is a play on "catnip" and "differentiation".
3
+ Catniff is an experimental tensor ops library and autograd engine inspired by [micrograd](https://github.com/karpathy/micrograd), and its name is a play on "catnip" and "differentiation". The project is heavily in-dev currently, so keep in mind that APIs can be unstable and backwards-incompatible.
4
4
 
5
5
  ## Setup
6
6
 
@@ -22,6 +22,8 @@ L.backward();
22
22
  console.log(x.grad); // 5
23
23
  ```
24
24
 
25
+ View all examples in [`./examples`](./examples).
26
+
25
27
  ## Tensors
26
28
 
27
29
  Tensors in Catniff are either numbers (scalars/0-D tensors) or multidimensional number arrays (n-D tensors).
@@ -35,11 +37,21 @@ const B = 3;
35
37
  console.log(TensorMath.add(A, B));
36
38
  ```
37
39
 
40
+ If you want to be concise, you can use `TM` or `TMath`:
41
+ ```js
42
+ const { TM, TMath } = require("catniff");
43
+
44
+ const A = [ 1, 2, 3 ];
45
+ const B = 3;
46
+ console.log(TM.add(A, B));
47
+ console.log(TMath.add(A, B));
48
+ ```
49
+
38
50
  All available APIs are in `./src/tensor.ts`.
39
51
 
40
52
  ## Autograd
41
53
 
42
- To compute the gradient of our mathematical expression, we use the `Node` class to dynamically build our DAG:
54
+ To compute the gradient wrt muliple variables of our mathematical expression, we use the `Node` class to dynamically build our DAG:
43
55
  ```js
44
56
  const { Node } = require("catniff");
45
57
 
package/dist/tensor.d.ts CHANGED
@@ -58,3 +58,5 @@ export declare class TensorMath {
58
58
  static mv(tA: Tensor, tB: Tensor): Tensor;
59
59
  static matmul(tA: Tensor, tB: Tensor): Tensor;
60
60
  }
61
+ export declare const TM: typeof TensorMath;
62
+ export declare const TMath: typeof TensorMath;
package/dist/tensor.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TensorMath = void 0;
3
+ exports.TMath = exports.TM = exports.TensorMath = void 0;
4
4
  class TensorMath {
5
5
  static create(num, shape) {
6
6
  if (shape.length === 0) {
@@ -332,3 +332,5 @@ class TensorMath {
332
332
  }
333
333
  }
334
334
  exports.TensorMath = TensorMath;
335
+ exports.TM = TensorMath;
336
+ exports.TMath = TensorMath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catniff",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "A cute autograd engine for Javascript",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,7 +25,8 @@
25
25
  "framework",
26
26
  "neural-network",
27
27
  "machine-learning",
28
- "deep-learning"
28
+ "deep-learning",
29
+ "micrograd"
29
30
  ],
30
31
  "author": "nguyenphuminh",
31
32
  "license": "GPL-3.0",