catniff 0.8.9 → 0.8.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/dist/core.d.ts CHANGED
@@ -101,6 +101,8 @@ export declare class Tensor {
101
101
  softmin(dim?: number): Tensor;
102
102
  logsumexp(dim?: number): Tensor;
103
103
  logSoftmax(dim?: number): Tensor;
104
+ logaddexp(other: TensorValue | Tensor): Tensor;
105
+ lerp(end: TensorValue | Tensor, weight: TensorValue | Tensor): Tensor;
104
106
  add(other: TensorValue | Tensor): Tensor;
105
107
  sub(other: TensorValue | Tensor): Tensor;
106
108
  subtract: (other: TensorValue | Tensor) => Tensor;
package/dist/core.js CHANGED
@@ -1272,6 +1272,20 @@ class Tensor {
1272
1272
  }
1273
1273
  return this.sub(this.logsumexp(dim));
1274
1274
  }
1275
+ // Tensor (stable) logaddexp
1276
+ logaddexp(other) {
1277
+ other = this.handleOther(other);
1278
+ const max = this.maximum(other);
1279
+ const exp1 = this.sub(max).exp();
1280
+ const exp2 = other.sub(max).exp();
1281
+ return max.add(exp1.add(exp2).log());
1282
+ }
1283
+ // Tensor linear interpolation
1284
+ lerp(end, weight) {
1285
+ end = this.handleOther(end);
1286
+ weight = this.handleOther(weight);
1287
+ return this.add(weight.mul(end.sub(this)));
1288
+ }
1275
1289
  // Tensor element-wise addition
1276
1290
  add(other) {
1277
1291
  return this.elementWiseABDAG(other, (a, b) => a + b, (self, other, outGrad) => outGrad, (self, other, outGrad) => outGrad);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catniff",
3
- "version": "0.8.9",
3
+ "version": "0.8.10",
4
4
  "description": "Torch-like deep learning framework for Javascript",
5
5
  "main": "index.js",
6
6
  "scripts": {