catniff 0.7.3 → 0.7.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.
package/dist/core.d.ts CHANGED
@@ -220,7 +220,7 @@ export declare class Tensor {
220
220
  val(): TensorValue;
221
221
  detach(): Tensor;
222
222
  clone(): Tensor;
223
- replace(other: Tensor | TensorValue, allowShapeMismatch?: boolean): Tensor;
223
+ replace(other: Tensor | TensorValue): Tensor;
224
224
  static backends: Map<string, Backend>;
225
225
  to(device: string): Tensor;
226
226
  to_(device: string): Tensor;
package/dist/core.js CHANGED
@@ -1994,17 +1994,21 @@ class Tensor {
1994
1994
  return out;
1995
1995
  }
1996
1996
  // Returns this tensor with value replaced with the value of another tensor
1997
- replace(other, allowShapeMismatch = false) {
1997
+ replace(other) {
1998
1998
  other = this.handleOther(other);
1999
1999
  // Verify shape
2000
- if (!allowShapeMismatch) {
2001
- for (let index = 0; index < this.shape.length; index++) {
2002
- if (this.shape[index] !== other.shape[index]) {
2003
- throw new Error("Shape mismatch when trying to do tensor value replacement");
2004
- }
2000
+ if (this.shape.length !== other.shape.length) {
2001
+ throw new Error("Shape mismatch when trying to do tensor value replacement");
2002
+ }
2003
+ for (let index = 0; index < this.shape.length; index++) {
2004
+ if (this.shape[index] !== other.shape[index]) {
2005
+ throw new Error("Shape mismatch when trying to do tensor value replacement");
2005
2006
  }
2006
2007
  }
2008
+ // Reassign values
2007
2009
  this.value = other.value;
2010
+ this.strides = other.strides;
2011
+ this.offset = other.offset;
2008
2012
  return this;
2009
2013
  }
2010
2014
  // Holds all available backends
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "catniff",
3
- "version": "0.7.3",
4
- "description": "A small Torch-like deep learning framework for Javascript",
3
+ "version": "0.7.4",
4
+ "description": "Torch-like deep learning framework for Javascript",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"