Lutz Roeder 1 год назад
Родитель
Сommit
19c253dc0c
3 измененных файлов с 3 добавлено и 28 удалено
  1. 3 25
      source/pytorch.js
  2. 0 2
      source/view.js
  3. 0 1
      test/models.json

+ 3 - 25
source/pytorch.js

@@ -1093,36 +1093,14 @@ pytorch.Container.data_pkl = class extends pytorch.Container {
         return null;
     }
 
-    constructor(type, data) {
+    constructor(type, module) {
         super();
         this.type = 'pytorch.data.pkl';
-        this._type = type;
-        this._data = data;
+        this.format = 'PyTorch Pickle';
+        this.module = module;
     }
 
     async read() {
-        this.format = 'PyTorch Pickle';
-        switch (this._type) {
-            case 'module': {
-                if (this._data) {
-                    this.module = this._data;
-                    delete this._data;
-                }
-                return this.module;
-            }
-            case 'tensor':
-            case 'tensor[]':
-            case 'tensor<>': {
-                if (this._data) {
-                    this.module = this._data;
-                    delete this._data;
-                }
-                return this.module;
-            }
-            default: {
-                throw new pytorch.Error("PyTorch standalone 'data.pkl' not supported.");
-            }
-        }
     }
 };
 

+ 0 - 2
source/view.js

@@ -5475,8 +5475,6 @@ view.Context = class {
                                     for (const name of types) {
                                         this.error(new view.Error(`Unknown type name '${name}'.`));
                                     }
-                                } else {
-                                    this._content.set(type, new view.Error("PyTorch standalone 'data.pkl' format not supported."));
                                 }
                             }
                             break;

+ 0 - 1
test/models.json

@@ -5574,7 +5574,6 @@
     "target":   "data.pkl",
     "source":   "https://github.com/lutzroeder/netron/files/9795497/data.pkl.zip[data.pkl]",
     "format":   "PyTorch Pickle",
-    "error":    "PyTorch standalone 'data.pkl' format not supported.",
     "link":     "https://github.com/lutzroeder/netron/issues/720"
   },
   {