Browse Source

Update onnx.js (#933)

Lutz Roeder 3 years ago
parent
commit
21f879d93c
1 changed files with 5 additions and 1 deletions
  1. 5 1
      source/onnx.js

+ 5 - 1
source/onnx.js

@@ -1223,7 +1223,8 @@ onnx.SequenceType = class {
     }
 
     toString() {
-        return 'sequence<' + this._elementType.toString() + '>';
+        const elementType = this._elementType ? this._elementType.toString() : '';
+        return 'sequence<' + elementType + '>';
     }
 };
 
@@ -1690,6 +1691,9 @@ onnx.GraphContext = class {
         else if (type.optional_type) {
             return new onnx.OptionalType(this.createType(type.optional_type.elem_type), denotation);
         }
+        else if (Object.keys(type).length == 0) {
+            return null;
+        }
         throw new onnx.Error("Unsupported tensor type '" + JSON.stringify(type) + "'.");
     }