3 Commits

Author SHA1 Message Date
  Lutz Roeder ff44f226aa Add MLIR support (#1044) 10 hours ago
  Lutz Roeder 34671acd49 Update pytorch-metadata.json (#1526) 21 hours ago
  Lutz Roeder 3541c229fd Use ES2015 default parameters 1 day ago
58 changed files with 599 additions and 463 deletions
Split View
  1. +7
    -11
      source/acuity.js
  2. +4
    -4
      source/armnn.js
  3. +5
    -5
      source/barracuda.js
  4. +2
    -2
      source/bigdl.js
  5. +6
    -6
      source/caffe.js
  6. +5
    -5
      source/caffe2.js
  7. +3
    -3
      source/circle.js
  8. +3
    -3
      source/cntk.js
  9. +6
    -6
      source/coreml.js
  10. +3
    -3
      source/darknet.js
  11. +2
    -4
      source/dl4j.js
  12. +2
    -2
      source/dlc.js
  13. +3
    -3
      source/dnn.js
  14. +1
    -1
      source/dot.js
  15. +6
    -6
      source/espresso.js
  16. +28
    -28
      source/executorch.js
  17. +2
    -2
      source/flax.js
  18. +2
    -2
      source/gguf.js
  19. +3
    -3
      source/hailo.js
  20. +2
    -2
      source/hickle.js
  21. +1
    -1
      source/kann.js
  22. +5
    -5
      source/keras.js
  23. +2
    -2
      source/lasagne.js
  24. +2
    -2
      source/lightgbm.js
  25. +2
    -2
      source/mediapipe.js
  26. +3
    -3
      source/megengine.js
  27. +317
    -209
      source/mlir.js
  28. +2
    -2
      source/mlnet.js
  29. +4
    -4
      source/mnn.js
  30. +6
    -6
      source/mslite.js
  31. +5
    -5
      source/mxnet.js
  32. +2
    -2
      source/ncnn.js
  33. +8
    -8
      source/nnabla.js
  34. +2
    -2
      source/numpy.js
  35. +3
    -3
      source/om.js
  36. +5
    -5
      source/onednn.js
  37. +15
    -15
      source/onnx.js
  38. +5
    -5
      source/openvino.js
  39. +4
    -4
      source/paddle.js
  40. +7
    -7
      source/pickle.js
  41. +2
    -2
      source/protobuf.js
  42. +27
    -0
      source/pytorch-metadata.json
  43. +9
    -9
      source/pytorch.js
  44. +2
    -2
      source/qnn.js
  45. +3
    -3
      source/rknn.js
  46. +6
    -6
      source/sklearn.js
  47. +3
    -3
      source/tengine.js
  48. +10
    -10
      source/text.js
  49. +7
    -7
      source/tf.js
  50. +3
    -3
      source/tflite.js
  51. +4
    -4
      source/tnn.js
  52. +3
    -3
      source/torch.js
  53. +2
    -2
      source/transformers.js
  54. +5
    -5
      source/tvm.js
  55. +5
    -7
      source/uff.js
  56. +1
    -1
      source/view.js
  57. +3
    -3
      source/xmodel.js
  58. +9
    -0
      tools/pytorch_script.py

+ 7
- 11
source/acuity.js View File

@@ -159,28 +159,24 @@ acuity.Node = class {

acuity.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
if (type) {
this.type = type;
}
if (visible === false) {
this.visible = false;
}
this.type = type;
this.visible = visible;
}
};

acuity.Value = class {

constructor(name, type, quantization, initializer) {
constructor(name, type = null, quantization = null, initializer = null) {
if (typeof name !== 'string') {
throw new acuity.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = type || null;
this.quantization = quantization || null;
this.initializer = initializer || null;
this.type = type;
this.quantization = quantization;
this.initializer = initializer;
}
};



+ 4
- 4
source/armnn.js View File

@@ -202,10 +202,10 @@ armnn.Node = class {

armnn.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};

@@ -234,9 +234,9 @@ armnn.Value = class {

armnn.Tensor = class {

constructor(tensor, category) {
constructor(tensor, category = '') {
this.type = new armnn.TensorType(tensor.info);
this.category = category || '';
this.category = category;
const data = tensor.data.data.slice(0);
this.values = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
}


+ 5
- 5
source/barracuda.js View File

@@ -79,19 +79,19 @@ barracuda.Graph = class {

barracuda.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};

barracuda.Value = class {

constructor(name, type, initializer) {
constructor(name, type = null, initializer = null) {
this.name = name;
this.type = type || null;
this.initializer = initializer || null;
this.type = type;
this.initializer = initializer;
}
};



+ 2
- 2
source/bigdl.js View File

@@ -82,10 +82,10 @@ bigdl.Graph = class {

bigdl.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};



+ 6
- 6
source/caffe.js View File

@@ -316,23 +316,23 @@ caffe.Graph = class {

caffe.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

caffe.Value = class {

constructor(name, type, initializer) {
constructor(name, type = null, initializer = null) {
if (typeof name !== 'string') {
throw new caffe.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = type || null;
this.initializer = initializer || null;
this.type = type;
this.initializer = initializer;
}
};



+ 5
- 5
source/caffe2.js View File

@@ -328,24 +328,24 @@ caffe2.Graph = class {

caffe2.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

caffe2.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new caffe2.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = !type && initializer ? initializer.type : type;
this.quantization = initializer && initializer.quantization ? initializer.quantization : null;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 3
- 3
source/circle.js View File

@@ -395,11 +395,11 @@ circle.Node = class {

circle.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};



+ 3
- 3
source/cntk.js View File

@@ -230,11 +230,11 @@ cntk.Graph = class {

cntk.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};



+ 6
- 6
source/coreml.js View File

@@ -268,24 +268,24 @@ coreml.Graph = class {

coreml.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

coreml.Value = class {

constructor(name, type, description, initializer) {
constructor(name, type, description = null, initializer = null) {
if (typeof name !== 'string') {
throw new coreml.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = !type && initializer ? initializer.type : type;
this.description = description || null;
this.initializer = initializer || null;
this.description = description;
this.initializer = initializer;
this.quantization = initializer ? initializer.quantization : null;
}
};


+ 3
- 3
source/darknet.js View File

@@ -779,11 +779,11 @@ darknet.Graph = class {

darknet.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;

}
};


+ 2
- 4
source/dl4j.js View File

@@ -143,12 +143,10 @@ dl4j.Graph = class {

dl4j.Argument = class {

constructor(name, value, visible) {
constructor(name, value, visible = true) {
this.name = name;
this.value = value;
if (visible === false) {
this.visible = false;
}
this.visible = visible;
}
};



+ 2
- 2
source/dlc.js View File

@@ -125,10 +125,10 @@ dlc.Graph = class {

dlc.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};



+ 3
- 3
source/dnn.js View File

@@ -105,13 +105,13 @@ dnn.Argument = class {

dnn.Value = class {

constructor(name, type, initializer, quantization) {
constructor(name, type = null, initializer = null, quantization = null) {
if (typeof name !== 'string') {
throw new dnn.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = type || null;
this.initializer = initializer || null;
this.type = type;
this.initializer = initializer;
if (quantization) {
this.quantization = {
type: 'lookup',


+ 1
- 1
source/dot.js View File

@@ -205,7 +205,7 @@ dot.Graph = class {

dot.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type;


+ 6
- 6
source/espresso.js View File

@@ -120,24 +120,24 @@ espresso.Graph = class {

espresso.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

espresso.Value = class {

constructor(name, type, description, initializer) {
constructor(name, type, description = null, initializer = null) {
if (typeof name !== 'string') {
throw new espresso.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = !type && initializer ? initializer.type : type;
this.description = description || null;
this.initializer = initializer || null;
this.description = description;
this.initializer = initializer;
this.quantization = initializer ? initializer.quantization : null;
}
};


+ 28
- 28
source/executorch.js View File

@@ -130,23 +130,23 @@ executorch.Graph = class {

executorch.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

executorch.Value = class Value {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new executorch.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer && initializer.type ? initializer.type : type || null;
this.initializer = initializer || null;
this.initializer = initializer;
}
};

@@ -280,8 +280,8 @@ executorch.TensorType = class {

executorch.TensorShape = class {

constructor(dimensions) {
this.dimensions = dimensions || [];
constructor(dimensions = []) {
this.dimensions = dimensions;
}

toString() {
@@ -584,23 +584,23 @@ xnnpack.Node = class {

xnnpack.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

xnnpack.Value = class Value {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new executorch.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer && initializer.type ? initializer.type : type || null;
this.initializer = initializer || null;
this.initializer = initializer;
}
};

@@ -668,8 +668,8 @@ xnnpack.TensorType = class {

xnnpack.TensorShape = class {

constructor(dimensions) {
this.dimensions = dimensions || [];
constructor(dimensions = []) {
this.dimensions = dimensions;
}

toString() {
@@ -839,23 +839,23 @@ vulkan.Node = class {

vulkan.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

vulkan.Value = class Value {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new executorch.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer && initializer.type ? initializer.type : type || null;
this.initializer = initializer || null;
this.initializer = initializer;
}
};

@@ -877,8 +877,8 @@ vulkan.TensorType = class {

vulkan.TensorShape = class {

constructor(dimensions) {
this.dimensions = dimensions || [];
constructor(dimensions = []) {
this.dimensions = dimensions;
}

toString() {
@@ -1206,23 +1206,23 @@ ethosu.Graph = class {

ethosu.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

ethosu.Value = class Value {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new executorch.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer && initializer.type ? initializer.type : type || null;
this.initializer = initializer || null;
this.initializer = initializer;
}
};

@@ -1246,8 +1246,8 @@ ethosu.TensorType = class {

ethosu.TensorShape = class {

constructor(dimensions) {
this.dimensions = dimensions || [];
constructor(dimensions = []) {
this.dimensions = dimensions;
}

toString() {


+ 2
- 2
source/flax.js View File

@@ -99,13 +99,13 @@ flax.Argument = class {

flax.Value = class {

constructor(name, initializer) {
constructor(name, initializer = null) {
if (typeof name !== 'string') {
throw new flax.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer ? initializer.type : null;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 2
- 2
source/gguf.js View File

@@ -81,9 +81,9 @@ gguf.Model = class {

gguf.Graph = class {

constructor(graph, type) {
constructor(graph, type = '') {
this.name = graph.type;
this.type = type || '';
this.type = type;
this.nodes = [];
this.inputs = [];
this.outputs = [];


+ 3
- 3
source/hailo.js View File

@@ -108,11 +108,11 @@ hailo.Graph = class {

hailo.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};



+ 2
- 2
source/hickle.js View File

@@ -89,13 +89,13 @@ hickle.Argument = class {

hickle.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new hickle.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = !type && initializer ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 1
- 1
source/kann.js View File

@@ -134,7 +134,7 @@ kann.Node = class {

kann.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type;


+ 5
- 5
source/keras.js View File

@@ -885,24 +885,24 @@ keras.Graph = class {

keras.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

keras.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new keras.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = !type && initializer ? initializer.type : type;
this.quantization = initializer && initializer.quantization ? initializer.quantization : null;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 2
- 2
source/lasagne.js View File

@@ -74,10 +74,10 @@ lasagne.Graph = class {

lasagne.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};



+ 2
- 2
source/lightgbm.js View File

@@ -74,10 +74,10 @@ lightgbm.Graph = class {

lightgbm.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};



+ 2
- 2
source/mediapipe.js View File

@@ -193,12 +193,12 @@ mediapipe.Argument = class {

mediapipe.Value = class {

constructor(name, type) {
constructor(name, type = null) {
if (typeof name !== 'string') {
throw new mediapipe.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = type || null;
this.type = type;
}
};



+ 3
- 3
source/megengine.js View File

@@ -403,11 +403,11 @@ megengine.Graph = class {

megengine.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};



+ 317
- 209
source/mlir.js View File

@@ -53,9 +53,10 @@ mlir.ModelFactory = class {
switch (context.type) {
case 'mlir.text': {
const decoder = await context.read('text.decoder');
const parser = new mlir.Parser(decoder, metadata);
const obj = await parser.read();
return new mlir.Model(metadata, obj);
const state = new mlir.ParserState();
const parser = new mlir.Parser(state, decoder, metadata);
const block = await parser.parse();
return new mlir.Model(metadata, block, state.attributeAliasDefinitions);
}
case 'mlir.binary': {
const reader = await context.read('binary');
@@ -72,11 +73,11 @@ mlir.ModelFactory = class {

mlir.Model = class {

constructor(metadata, obj) {
constructor(metadata, block, attributeAliasDefinitions) {
this.format = 'MLIR';
this.modules = [];
this.metadata = [];
for (const op of obj.operations) {
for (const op of block.operations) {
if (op.name.endsWith('.func')) {
const graph = new mlir.Graph(metadata, op);
this.modules.push(graph);
@@ -94,15 +95,13 @@ mlir.Model = class {
}
}
}
if (obj.definitions) {
for (const attribute of obj.definitions) {
let value = attribute.type;
if (!value) {
value = typeof attribute.value === 'string' ? attribute.value : JSON.stringify(attribute.value);
}
const metadata = new mlir.Argument(attribute.name, value, 'attribute');
this.metadata.push(metadata);
for (const [name, attribute] of attributeAliasDefinitions) {
let value = attribute.type;
if (!value) {
value = typeof attribute.value === 'string' ? attribute.value : JSON.stringify(attribute.value);
}
const metadata = new mlir.Argument(name, value, 'attribute');
this.metadata.push(metadata);
}
}
};
@@ -300,10 +299,10 @@ mlir.Graph = class {

mlir.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
// Normalize common type aliases and accept extended MLIR types
if (this.type) {
// Convert mlir.Type objects to strings for high-level usage
@@ -862,15 +861,20 @@ mlir.Tokenizer = class {
}
};

mlir.ParserState = class {
constructor() {
this.defaultDialectStack = ['builtin'];
this.attributeAliasDefinitions = new Map();
this.typeAliasDefinitions = new Map();
}
};

mlir.Parser = class {

constructor(decoder, metadata) {
constructor(state, decoder, metadata) {
this._tokenizer = new mlir.Tokenizer(decoder);
this._token = this._tokenizer.read();
this._state = {
defaultDialectStack: ['builtin']
};
this._typeAliases = new Map();
this._state = state;
this._dialects = new Map();
const operations = metadata.operations;
this._dialects.set('builtin', new mlir.BuiltinDialect(operations));
@@ -1014,6 +1018,7 @@ mlir.Parser = class {
this._redirect = new Map([
['builtin.func', 'func.func'],
['builtin.constant', 'arith.constant'],
['func.constant', 'arith.constant'],
['builtin.return', 'func.return'],
['builtin.select', 'arith.select'],
['scf.select', 'arith.select'],
@@ -1068,52 +1073,28 @@ mlir.Parser = class {
]);
}

async read() {
return this.parse();
}

parse() {
async parse() {
// Reference: Parser.cpp TopLevelOperationParser::parse
// https://mlir.llvm.org/docs/LangRef/#top-level-productions
const block = {
operations: [],
definitions: []
operations: []
};
while (true) {
if (this.match('eof')) {
break;
}
if (this.match('#')) { // attribute-alias-def
const name = this.expect();
this.expect('=');
// Handle pre-2020 bare affine map syntax: (dims) [symbols] -> (results)
// Changed to affine_map<...> in llvm/llvm-project@4268e4f4b84b (Jan 2020) to avoid conflicts with function types.
let value = null;
if (this.match('(')) {
const dims = this.skip('(', ')');
const symbols = this.match('[') ? this.skip('[', ']') : '';
this.expect('->');
const results = this.match('(') ? this.skip('(', ')') : '';
value = { value: `affine_map<${dims}${symbols} -> ${results}>`, name: 'affine_map' };
} else {
value = this.parseAttribute();
}
block.definitions.push({ name, value });
if (this.match('#')) {
// Reference: parseAttributeAliasDef stores in state.symbols.attributeAliasDefinitions
this.parseAttributeAliasDef();
continue;
}
if (this.match('!')) { // type-alias-def
const name = this.expect('!');
this.expect('=');
const type = this.parseType();
block.definitions.push({ name, type });
this._typeAliases.set(name, type);
if (this.match('!')) {
// Reference: parseTypeAliasDef stores in state.symbols.typeAliasDefinitions
this.parseTypeAliasDef();
continue;
}
if (this.match('{-#')) { // file metadata
this.expect('{-#');
while (!this.match('#-}') && !this.match('eof')) {
this._token = this._tokenizer.read();
}
this.expect('#-}');
if (this.match('{-#')) {
this.parseFileMetadataDictionary();
continue;
}
const op = this.parseOperation();
@@ -1122,6 +1103,48 @@ mlir.Parser = class {
return block;
}

// Reference: Parser.cpp parseAttributeAliasDef lines 2695-2725
// attribute-alias-def ::= '#' alias-name `=` attribute-value
parseAttributeAliasDef() {
const aliasName = this.expect();
this.expect('=');
// Handle pre-2020 bare affine map syntax: (dims) [symbols] -> (results)
// Changed to affine_map<...> in llvm/llvm-project@4268e4f4b84b (Jan 2020)
let attr = null;
if (this.match('(')) {
const dims = this.skip('(', ')');
const symbols = this.match('[') ? this.skip('[', ']') : '';
this.expect('->');
const results = this.match('(') ? this.skip('(', ')') : '';
attr = { value: `affine_map<${dims}${symbols} -> ${results}>`, name: 'affine_map' };
} else {
// Reference: Attribute attr = parseAttribute();
attr = this.parseAttribute();
}
// Reference: state.symbols.attributeAliasDefinitions[aliasName] = attr;
this._state.attributeAliasDefinitions.set(aliasName, attr);
}

// Reference: Parser.cpp parseTypeAliasDef lines 2727-2757
// type-alias-def ::= '!' alias-name `=` type
parseTypeAliasDef() {
const aliasName = this.expect('!');
this.expect('=');
const type = this.parseType();
// Reference: state.symbols.typeAliasDefinitions[aliasName] = type;
this._state.typeAliasDefinitions.set(aliasName, type);
}

// Reference: Parser.cpp parseFileMetadataDictionary
// file-metadata-dict ::= '{-#' file-metadata-entry* `#-}'
parseFileMetadataDictionary() {
this.expect('{-#');
while (!this.match('#-}') && !this.match('eof')) {
this._token = this._tokenizer.read();
}
this.expect('#-}');
}

parseFunctionArgumentList(allowVariadic) {
const inputs = [];
let isVariadic = false;
@@ -1654,33 +1677,36 @@ mlir.Parser = class {
const location = {};
this.expect('(');
if (this.match('string')) {
const str = this.expect('string');
if (this.match('(')) {
location.name = str;
this.expect('(');
location.child = this.parseLocationContent();
const text = this.expect('string');
let content = `"${text}"`;
if (this.accept('(')) {
const child = this.parseLocationContent();
this.expect(')');
} else {
location.file = str;
content += `(${child})`;
} else if (this.accept(':')) {
const line = this.expect('int');
content += `:${line}`;
if (this.accept(':')) {
location.line = this.expect('int');
if (this.accept(':')) {
location.col = this.expect('int');
if (this.accept('id', 'to')) {
const col = this.expect('int');
content += `:${col}`;
if (this.accept('id', 'to')) {
if (this.accept(':')) {
const endLine = this.expect('int');
content += ` to:${endLine}`;
if (this.accept(':')) {
location.endLine = this.expect('int');
if (this.accept(':')) {
location.endCol = this.expect('int');
}
const endCol = this.expect('int');
content += `:${endCol}`;
}
}
}
}
}
location.value = `loc(${content})`;
} else if (this.match('#')) {
location.alias = this.expect();
const alias = this.expect();
location.value = `loc(${alias})`;
} else if (this.accept('id', 'unknown')) {
location.unknown = true;
location.value = 'loc(unknown)';
} else if (this.accept('id', 'callsite')) {
this.expect('(');
location.type = 'callsite';
@@ -2205,7 +2231,7 @@ mlir.Parser = class {
if (attrT) {
return attrT(this, type);
}
return this.parseAttribute();
return this.parseAttribute(type);
}

parseType() {
@@ -2302,7 +2328,7 @@ mlir.Parser = class {

// Reference: DialectSymbolParser.cpp parseExtendedType
parseExtendedType() {
return this.parseExtendedSymbol('!', this._typeAliases, (dialectName, symbolData) => {
return this.parseExtendedSymbol('!', this._state.typeAliasDefinitions, (dialectName, symbolData) => {
if (!this._dialects.has(dialectName)) {
throw new mlir.Error(`Unsupported dialect '${dialectName}' ${this.location()}`);
}
@@ -2589,42 +2615,39 @@ mlir.Parser = class {
return null;
}

// Reference: AttributeParser.cpp parseAttribute
parseAttribute(/* type */) {
// Reference: AttributeParser.cpp parseAttribute(Type type = {})
// When type is null (default), parse `: type` suffix for int/float/string
// When type is provided, use it directly without parsing suffix
parseAttribute(type = null) {
// Parse an AffineMap or IntegerSet attribute.
if (this.match('id', 'affine_map') || this.match('id', 'affine_set')) {
const name = this.expect();
const args = this.skip('<', '>');
return { name, args };
return { value: `${name}${args}` };
}
// Parse an array attribute.
// Reference: AttributeParser.cpp lines 73-84
if (this.match('[')) {
this.expect('[');
const elements = [];
while (!this.accept(']')) {
// Reference: elements.push_back(parseAttribute());
const item = this.parseAttribute();
// Handle optional type annotation (e.g., 8 : index)
if (this.accept(':')) {
item.type = this.parseType();
}
elements.push(item.value);
this.accept(',');
}
// Handle special `[a] x [b]` syntax (dialect-specific)
if (this.accept('id', 'x')) {
const list = [Array.from(elements)];
const value = [Array.from(elements)];
this.expect('[');
const second = [];
while (!this.accept(']')) {
const item = this.parseAttribute();
if (this.accept(':')) {
item.type = this.parseType();
}
second.push(item.value);
this.accept(',');
}
list.push(second);
return { value: list };
value.push(second);
return { value };
}
return { value: elements };
}
@@ -2634,25 +2657,37 @@ mlir.Parser = class {
return { value, type: new mlir.PrimitiveType('i1') };
}
// Parse a dense elements attribute.
// Reference: AttributeParser.cpp parseDenseElementsAttr
// Reference: AttributeParser.cpp parseDenseElementsAttr(Type attrType)
// Format: dense<literal> : type (type suffix only if attrType not provided)
if (this.match('id', 'dense')) {
this.expect('id');
this.expect('<');
if (this.accept('>')) {
return { value: null, type: 'dense' };
let value = null;
if (!this.accept('>')) {
const literalParser = new mlir.TensorLiteralParser(this);
value = literalParser.parse(/* allowHex */ true);
this.expect('>');
}
const literalParser = new mlir.TensorLiteralParser(this);
const value = literalParser.parse(/* allowHex */ true);
this.expect('>');
return { value, type: 'dense' };
// Reference: if (!attrType) { parseToken(Token::colon); attrType = parseType(); }
if (!type) {
this.expect(':');
type = this.parseType();
}
return { value, type };
}
// Parse a dense resource elements attribute.
// Reference: AttributeParser.cpp parseDenseResourceElementsAttr(Type attrType)
// Format: dense_resource<handle> : type (type suffix only if attrType not provided)
if (this.match('id', 'dense_resource')) {
this.expect('id');
this.expect('<');
const resourceHandle = this.expect();
const value = this.expect();
this.expect('>');
return { value: resourceHandle, type: 'dense' };
if (!type) {
this.expect(':');
type = this.parseType();
}
return { value, type };
}
// Parse a dense array attribute.
if (this.match('id', 'array')) {
@@ -2674,36 +2709,55 @@ mlir.Parser = class {
if (this.match('{')) {
const attributes = [];
this.parseAttributeDict(attributes);
const obj = {};
const value = {};
for (const attribute of attributes) {
obj[attribute.name] = attribute.value;
value[attribute.name] = attribute.value;
}
return { value: obj };
return { value };
}
// Parse an extended attribute, i.e. alias or dialect attribute.
// Reference: AttributeParser.cpp - parse extended attr, then optionally parse : type
if (this.match('#')) {
return this.parseExtendedAttr();
const attr = this.parseExtendedAttr();
// Only parse : type suffix if type not already provided
if (!type && this.accept(':')) {
attr.type = this.parseType();
}
return attr;
}
const parseType = (type, defaultType) => {
if (type) {
return type;
}
return this.accept(':') ? this.parseType() : defaultType;
};
// Parse floating point attribute.
// Reference: AttributeParser.cpp parseFloatAttr
if (this.match('float')) {
const value = this.expect();
return { value, type: new mlir.PrimitiveType('f64') };
type = parseType(type, new mlir.PrimitiveType('f64'));
return { value, type };
}
// Parse integer attribute.
// Reference: AttributeParser.cpp parseDecOrHexAttr lines 406-418
if (this.match('int')) {
const value = this.expect();
return { value, type: new mlir.PrimitiveType('i64') };
type = parseType(type, new mlir.PrimitiveType('i64'));
return { value, type };
}
// Parse negative number.
// Reference: AttributeParser.cpp parseAttribute case Token::minus
if (this.match('keyword', '-')) {
this.expect();
if (this.match('int')) {
const value = `-${this.expect()}`;
return { value, type: new mlir.PrimitiveType('i64') };
type = parseType(type, new mlir.PrimitiveType('i64'));
return { value, type };
}
if (this.match('float')) {
const value = `-${this.expect()}`;
return { value, type: new mlir.PrimitiveType('f64') };
type = parseType(type, new mlir.PrimitiveType('f64'));
return { value, type };
}
throw new mlir.Error(`Expected integer or float after '-' ${this.location()}`);
}
@@ -2712,23 +2766,30 @@ mlir.Parser = class {
return this.parseLocation();
}
// Parse a sparse elements attribute.
// Reference: AttributeParser.cpp parseSparseElementsAttr
// Reference: AttributeParser.cpp parseSparseElementsAttr(Type attrType)
// Format: sparse<indices, values> : type (type suffix only if attrType not provided)
if (this.match('id', 'sparse')) {
this.expect('id');
this.expect('<');
let indices = null;
let values = null;
// Parse empty sparse: sparse<>
if (this.accept('>')) {
return { value: { indices: null, values: null }, type: 'sparse' };
}
// Parse indices (no hex allowed)
const indiceParser = new mlir.TensorLiteralParser(this);
const indices = indiceParser.parse(/* allowHex */ false);
this.expect(',');
// Parse values (hex allowed)
const valuesParser = new mlir.TensorLiteralParser(this);
const values = valuesParser.parse(/* allowHex */ true);
this.expect('>');
return { value: { indices, values }, type: 'sparse' };
if (!this.accept('>')) {
// Parse indices (no hex allowed)
const indiceParser = new mlir.TensorLiteralParser(this);
indices = indiceParser.parse(/* allowHex */ false);
this.expect(',');
// Parse values (hex allowed)
const valuesParser = new mlir.TensorLiteralParser(this);
values = valuesParser.parse(/* allowHex */ true);
this.expect('>');
}
let sparseType = type;
if (!sparseType) {
this.expect(':');
sparseType = this.parseType();
}
return { value: { indices, values }, type: sparseType };
}
// Parse a strided layout attribute.
if (this.match('id', 'strided')) {
@@ -2737,15 +2798,26 @@ mlir.Parser = class {
return { value: `strided${body}`, type: 'strided' };
}
// Parse a distinct attribute.
// Reference: AttributeParser.cpp parseDistinctAttr
// Format: distinct[id]<attribute>
if (this.match('id', 'distinct')) {
this.expect('id');
const body = this.skip('[', ']');
return { value: `distinct${body}`, type: 'distinct' };
const id = this.skip('[', ']');
this.expect('<');
let referencedAttr = null;
if (!this.match('>')) {
// Reference: referencedAttr = parseAttribute(type);
referencedAttr = this.parseAttribute();
}
this.expect('>');
return { value: `distinct${id}`, referencedAttr, type: 'distinct' };
}
// Parse a string attribute.
// Reference: AttributeParser.cpp case Token::string lines 160-168
if (this.match('string')) {
const value = this.expect();
return { value, type: new mlir.PrimitiveType('string') };
type = parseType(type, new mlir.PrimitiveType('string'));
return { value, type };
}
// Parse a symbol reference attribute.
if (this.match('@')) {
@@ -2796,13 +2868,15 @@ mlir.Parser = class {
return { value };
}
// Reference: AttributeParser.cpp default case - try to parse a type attribute
const type = this.parseOptionalType();
if (type) {
return { value: type, type: 'type' };
const typeAttr = this.parseOptionalType();
if (typeAttr) {
return { value: typeAttr, type: 'type' };
}
throw new mlir.Error(`Unexpected attribute token '${this._token.value}' ${this.location()}`);
}

// Reference: DialectSymbolParser.cpp parseExtendedSymbol
// Parses #dialect.symbol or #alias - does NOT parse trailing : type
parseExtendedAttr() {
const name = this.expect('#');
let value = name;
@@ -2813,13 +2887,7 @@ mlir.Parser = class {
const body = this.skip('(', ')');
value = name + body;
}
// Parse an optional trailing colon type.
// Reference: DialectSymbolParser.cpp line 264-267
let type = null;
if (this.accept(':')) {
type = this.parseType();
}
return { value, type };
return { value };
}

parseOptionalAttribute(type) {
@@ -3889,6 +3957,27 @@ mlir.Dialect = class {
this.registerCustomAttribute('AnyAttrOf', this._parseAnyAttrOf.bind(this));
this.registerCustomAttribute('ArrayAttr', this._parseArrayAttr.bind(this));
this.registerCustomAttribute('TypedArrayAttrBase', this._parseArrayAttr.bind(this));
// Register integer attribute types - parse without : type suffix
// Reference: for typed attributes, the type is known so no suffix needed
this.registerCustomAttribute('I64Attr', this._parseIntegerAttr.bind(this, 'i64'));
this.registerCustomAttribute('I32Attr', this._parseIntegerAttr.bind(this, 'i32'));
this.registerCustomAttribute('I16Attr', this._parseIntegerAttr.bind(this, 'i16'));
this.registerCustomAttribute('I8Attr', this._parseIntegerAttr.bind(this, 'i8'));
this.registerCustomAttribute('I1Attr', this._parseIntegerAttr.bind(this, 'i1'));
this.registerCustomAttribute('SI64Attr', this._parseIntegerAttr.bind(this, 'si64'));
this.registerCustomAttribute('SI32Attr', this._parseIntegerAttr.bind(this, 'si32'));
this.registerCustomAttribute('UI64Attr', this._parseIntegerAttr.bind(this, 'ui64'));
this.registerCustomAttribute('UI32Attr', this._parseIntegerAttr.bind(this, 'ui32'));
this.registerCustomAttribute('IndexAttr', this._parseIntegerAttr.bind(this, 'index'));
// Register float attribute types
this.registerCustomAttribute('F64Attr', this._parseFloatAttr.bind(this, 'f64'));
this.registerCustomAttribute('F32Attr', this._parseFloatAttr.bind(this, 'f32'));
this.registerCustomAttribute('F16Attr', this._parseFloatAttr.bind(this, 'f16'));
this.registerCustomAttribute('BF16Attr', this._parseFloatAttr.bind(this, 'bf16'));
// String attributes - pass string type to prevent : type suffix parsing
this.registerCustomAttribute('StrAttr', this._parseStrAttr.bind(this));
// Level attribute - parse as index to prevent : type suffix parsing
this.registerCustomAttribute('LevelAttr', this._parseIntegerAttr.bind(this, 'index'));
this.registerCustomType('Optional', this._parseOptional.bind(this));
for (const metadata of operations.get(name) || []) {
const op = { metadata };
@@ -4398,10 +4487,11 @@ mlir.Dialect = class {
const attrInfo = opInfo.metadata && opInfo.metadata.attributes && opInfo.metadata.attributes.find((attr) => attr.name === refName);
const attrType = attrInfo ? attrInfo.type : null;
let attrValue = null;
// Pass type to suppress : type suffix parsing (it's a separate directive in assembly format)
if (attrType && attrType !== 'Attribute') {
attrValue = this._parseCustomAttributeWithFallback(parser, attrType);
} else {
attrValue = parser.parseAttribute();
attrValue = parser.parseAttribute(attrType || 'Attribute');
}
if (attrValue) {
const value = attrValue.value === undefined ? attrValue : attrValue.value;
@@ -4760,7 +4850,13 @@ mlir.Dialect = class {
if (parser.match('id') || parser.match('#') || parser.match('@') || parser.match('string') || parser.match('[')) {
const attrInfo = opInfo.metadata && opInfo.metadata.attributes && opInfo.metadata.attributes.find((attr) => attr.name === firstElem.name);
const attrType = attrInfo ? attrInfo.type : null;
const result = this._parseCustomAttributeWithFallback(parser, attrType);
// Pass type to suppress : type suffix parsing (it's a separate directive in assembly format)
let result = null;
if (attrType && attrType !== 'Attribute') {
result = this._parseCustomAttributeWithFallback(parser, attrType);
} else {
result = parser.parseOptionalAttribute(attrType || 'Attribute');
}
if (result !== null) {
const value = result.value === undefined ? result : result.value;
op.attributes.push({ name: firstElem.name, value });
@@ -4909,7 +5005,7 @@ mlir.Dialect = class {
return { value };
}
}
return parser.parseOptionalAttribute();
return parser.parseOptionalAttribute(type);
}

_parseOptionalAttr(parser, type) {
@@ -4977,25 +5073,10 @@ mlir.Dialect = class {
return this._parseCustomAttributeWithFallback(parser, baseType);
}

// Reference: TypedAttrInterface attributes parse via parseAttribute()
// parseAttribute handles `: type` suffix internally when type is null
_parseTypedAttrInterface(parser) {
if (parser.match('#')) {
const attr = parser.parseAttribute();
// Handle typed attribute with trailing : type
if (parser.accept(':')) {
const type = parser.parseType();
attr.type = type;
}
return attr;
}
const value = parser.parseAttribute();
if (parser.accept(':')) {
const type = parser.parseType();
if (value && value.value !== undefined) {
return { value: value.value, attrType: type };
}
return { value, attrType: type };
}
return value;
return parser.parseAttribute();
}

_parseUnitAttr() {
@@ -5010,6 +5091,28 @@ mlir.Dialect = class {
return null;
}

// Parse typed integer attribute (I64Attr, I32Attr, etc.)
// Reference: for typed attributes, the type is known so no : type suffix parsing
_parseIntegerAttr(typeName, parser) {
const type = new mlir.PrimitiveType(typeName);
// Use parseAttribute with the known type to avoid suffix parsing
return parser.parseAttribute(type);
}

// Parse typed float attribute (F64Attr, F32Attr, etc.)
_parseFloatAttr(typeName, parser) {
const type = new mlir.PrimitiveType(typeName);
// Use parseAttribute with the known type to avoid suffix parsing
return parser.parseAttribute(type);
}

// Parse string attribute (StrAttr)
// Pass string type to prevent : type suffix parsing
_parseStrAttr(parser) {
const type = new mlir.PrimitiveType('string');
return parser.parseAttribute(type);
}

_parseDynamicIndexList(parser, op, args) {
// Determine delimiter from args (default to square brackets for backward compatibility)
// Args format: [$dynamic_basis, $static_basis, $scalable_basis, "::mlir::AsmParser::Delimiter::Paren"]
@@ -6348,7 +6451,8 @@ mlir.MemRefDialect = class extends mlir.Dialect {
if (parser.accept('id', 'uninitialized')) {
op.attributes.push({ name: initialValueArg, value: 'uninitialized' });
} else {
const initialValue = parser.parseAttribute();
// Pass the type to parseAttribute to suppress : type suffix parsing
const initialValue = parser.parseAttribute(type);
op.attributes.push({ name: initialValueArg, value: initialValue });
}
}
@@ -8103,14 +8207,15 @@ mlir.StreamDialect = class extends mlir.IREEDialect {
} while (parser.accept(','));
}

// Parse: @entry_point or [@entry_point1, @entry_point2]
// Parse: @entry_point or {@entry_point1, @entry_point2}
// Reference: StreamOps.cpp parseDispatchEntryPoints
_parseDispatchEntryPoints(parser, op /*, args */) {
if (parser.accept('[')) {
if (parser.accept('{')) {
do {
const symbol = parser.expect('@');
op.attributes.push({ name: 'entry_point', value: symbol });
} while (parser.accept(','));
parser.expect(']');
parser.expect('}');
} else {
const symbol = parser.expect('@');
op.attributes.push({ name: 'entry_point', value: symbol });
@@ -9937,18 +10042,12 @@ mlir.SPIRVDialect = class extends mlir.Dialect {
}
return true;
}
// Reference: ControlFlowOps.cpp BranchConditionalOp::parse
// Format: spirv.BranchConditional %cond [trueWeight, falseWeight]?, ^trueTarget(args)?, ^falseTarget(args)?
if (opName === 'spirv.BranchConditional' || opName === 'spv.BranchConditional') {
const condition = parser.parseAttribute();
op.operands.push(condition);
parser.expect(',');
if (!op.successors) {
op.successors = [];
}
const trueLabel = parser.expect('^');
op.successors.push({ label: trueLabel });
parser.expect(',');
const falseLabel = parser.expect('^');
op.successors.push({ label: falseLabel });
// Parse optional branch weights [trueWeight, falseWeight]
if (parser.accept('[')) {
const weights = [];
while (!parser.match(']')) {
@@ -9962,6 +10061,59 @@ mlir.SPIRVDialect = class extends mlir.Dialect {
op.attributes.push({ name: 'branch_weights', value: weights });
}
}
parser.expect(',');
if (!op.successors) {
op.successors = [];
}
// Parse true branch successor
const trueLabel = parser.expect('^');
const trueSucc = { label: trueLabel };
if (parser.accept('(')) {
trueSucc.arguments = [];
while (!parser.match(')') && !parser.match(':')) {
if (parser.match('%')) {
trueSucc.arguments.push({ value: parser.expect('%') });
parser.accept(',');
} else {
break;
}
}
if (parser.accept(':')) {
let idx = 0;
while (!parser.match(')') && idx < trueSucc.arguments.length) {
trueSucc.arguments[idx].type = parser.parseType().toString();
idx++;
parser.accept(',');
}
}
parser.expect(')');
}
op.successors.push(trueSucc);
parser.expect(',');
// Parse false branch successor
const falseLabel = parser.expect('^');
const falseSucc = { label: falseLabel };
if (parser.accept('(')) {
falseSucc.arguments = [];
while (!parser.match(')') && !parser.match(':')) {
if (parser.match('%')) {
falseSucc.arguments.push({ value: parser.expect('%') });
parser.accept(',');
} else {
break;
}
}
if (parser.accept(':')) {
let idx = 0;
while (!parser.match(')') && idx < falseSucc.arguments.length) {
falseSucc.arguments[idx].type = parser.parseType().toString();
idx++;
parser.accept(',');
}
}
parser.expect(')');
}
op.successors.push(falseSucc);
return true;
}
if (opName === 'spirv.CompositeConstruct' || opName === 'spv.CompositeConstruct') {
@@ -10157,50 +10309,6 @@ mlir.SPIRVDialect = class extends mlir.Dialect {
}
return true;
}
if (opName === 'spirv.BranchConditional' || opName === 'spv.BranchConditional') {
op.operands = parser.parseArguments();

// Parse successors
if (parser.match('^')) {
op.successors = [];
while (parser.match('^')) {
const successor = {};
successor.label = parser.expect('^');
// Parse successor arguments with types
// Format: ^label(%val1, %val2, ... : type1, type2, ...)
if (parser.accept('(')) {
successor.arguments = [];
// Parse all values first
while (!parser.match(':') && !parser.match(')')) {
if (parser.match('%')) {
const arg = {};
arg.value = parser.expect('%');
successor.arguments.push(arg);
parser.accept(',');
} else {
break;
}
}
// Parse types if present
if (parser.accept(':')) {
let idx = 0;
while (idx < successor.arguments.length && !parser.match(')')) {
const type = parser.parseType();
successor.arguments[idx].type = type;
idx++;
parser.accept(',');
}
}
parser.accept(')');
}
op.successors.push(successor);
if (!parser.accept(',')) {
break;
}
}
}
return true;
}
// spirv.CompositeInsert with 'into' keyword
// Format: spirv.CompositeInsert %object, %composite[indices] : object-type into composite-type
if (opName === 'spirv.CompositeInsert' || opName === 'spv.CompositeInsert') {
@@ -13253,7 +13361,7 @@ mlir.LLVMDialect = class extends mlir.Dialect {
parser.parseOptionalAttrDictWithKeyword(op.attributes);
if (parser.match('{')) {
const region = {};
parser.parseRegion(region);
parser.parseRegion(region, argResult.arguments);
op.regions.push(region);
}
return true;


+ 2
- 2
source/mlnet.js View File

@@ -115,10 +115,10 @@ mlnet.Module = class {

mlnet.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};



+ 4
- 4
source/mnn.js View File

@@ -247,19 +247,19 @@ mnn.Node = class {

mnn.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};

mnn.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
this.name = name;
this.type = !type && initializer ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 6
- 6
source/mslite.js View File

@@ -169,19 +169,19 @@ mslite.Node = class {

mslite.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};

mslite.Value = class {

constructor(name, tensor, initializer) {
constructor(name, tensor, initializer = null) {
this.name = name;
this.type = initializer ? initializer.type : new mslite.TensorType(tensor.dataType, tensor.dims);
this.initializer = initializer || null;
this.initializer = initializer;
if (Array.isArray(tensor.quantParams) && tensor.quantParams.length > 0) {
this.quantization = {
type: 'linear',
@@ -199,10 +199,10 @@ mslite.Value = class {

mslite.Tensor = class {

constructor(type, data) {
constructor(type, data = null) {
this.type = type;
this.encoding = type.dataType === 'string' ? '|' : '<';
this._data = data || null;
this._data = data;
}

get values() {


+ 5
- 5
source/mxnet.js View File

@@ -434,23 +434,23 @@ mxnet.Graph = class {

mxnet.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

mxnet.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new mxnet.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = !name && initializer && initializer.name ? initializer.name : name;
this.type = !type && initializer && initializer.type ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 2
- 2
source/ncnn.js View File

@@ -271,13 +271,13 @@ ncnn.Argument = class {

ncnn.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new ncnn.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
this.quantization = initializer ? initializer.quantization : null;
}
};


+ 8
- 8
source/nnabla.js View File

@@ -179,30 +179,30 @@ nnabla.Graph = class {

nnabla.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

nnabla.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
this.name = name;
this.type = !type && initializer && initializer.type ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};

nnabla.Node = class {

constructor(metadata, func, attributes, inputs, outputs) {
constructor(metadata, func, attributes = [], inputs = [], outputs = []) {
this.name = func.name;
this.type = metadata.type(func.type) || { name: func.type, type: func.type };
this.attributes = attributes || [];
this.outputs = outputs || [];
this.attributes = attributes;
this.outputs = outputs;
this.chain = [];
// "nonlinearity" does not match metadata type
const get_nonlinearity = (name) => {


+ 2
- 2
source/numpy.js View File

@@ -100,13 +100,13 @@ numpy.Argument = class {

numpy.Value = class {

constructor(name, initializer) {
constructor(name, initializer = null) {
if (typeof name !== 'string') {
throw new numpy.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer.type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 3
- 3
source/om.js View File

@@ -258,7 +258,7 @@ om.Node = class {

om.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type;
@@ -267,13 +267,13 @@ om.Argument = class {

om.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new om.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 5
- 5
source/onednn.js View File

@@ -199,22 +199,22 @@ onednn.Node = class {

onednn.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};

onednn.Value = class {

constructor(name, type, initializer) {
constructor(name, type = null, initializer = null) {
if (typeof name !== 'string') {
throw new onednn.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = type || null;
this.initializer = initializer || null;
this.type = type;
this.initializer = initializer;
}
};



+ 15
- 15
source/onnx.js View File

@@ -251,25 +251,25 @@ onnx.Graph = class {

onnx.Argument = class {

constructor(name, value, type, description, visible) {
constructor(name, value, type = null, description = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.description = description || null;
this.visible = visible !== false;
this.type = type;
this.description = description;
this.visible = visible;
}
};

onnx.Value = class {

constructor(name, type, initializer, annotation, description) {
constructor(name, type = null, initializer = null, annotation = null, description = '') {
if (typeof name !== 'string') {
throw new onnx.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this._name = name;
this._type = type || null;
this._initializer = initializer || null;
this._description = description || '';
this._type = type;
this._initializer = initializer;
this._description = description;
this._quantization = annotation ? { type: 'annotation', value: annotation } : null;
}

@@ -447,8 +447,8 @@ onnx.Group = class {

onnx.Tensor = class {

constructor(context, tensor, category) {
this._category = category || null;
constructor(context, tensor, category = null) {
this._category = category;
if (tensor.indices && tensor.values) {
this._name = tensor.values.name || '';
this._type = context.createTensorType(tensor.values.data_type, tensor.dims, 'sparse');
@@ -649,11 +649,11 @@ onnx.Tensor = class {

onnx.TensorType = class {

constructor(dataType, shape, layout, denotation) {
constructor(dataType, shape, layout = null, denotation = null) {
this._dataType = dataType;
this._shape = shape;
this._layout = layout || null;
this._denotation = denotation || null;
this._layout = layout;
this._denotation = denotation;
}

get dataType() {
@@ -1624,12 +1624,12 @@ onnx.ProtoReader = class {
return undefined;
}

constructor(context, encoding, type, offset) {
constructor(context, encoding, type, offset = 0) {
this.name = 'onnx.proto';
this.context = context;
this.encoding = encoding;
this.type = type;
this.offset = offset || 0;
this.offset = offset;
this.locations = new Map();
}



+ 5
- 5
source/openvino.js View File

@@ -762,23 +762,23 @@ openvino.Node = class {

openvino.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

openvino.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new openvino.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 4
- 4
source/paddle.js View File

@@ -433,13 +433,13 @@ paddle.Argument = class {

paddle.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new paddle.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = !type && initializer ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};

@@ -586,10 +586,10 @@ paddle.Node = class {

paddle.Tensor = class {

constructor(type, data, category) {
constructor(type, data, category = '') {
this.type = type;
this.values = data;
this.category = category || '';
this.category = category;
}
};



+ 7
- 7
source/pickle.js View File

@@ -60,8 +60,8 @@ pickle.Model = class {

pickle.Module = class {

constructor(type, obj) {
this.type = type || '';
constructor(type = '', obj = null) {
this.type = type;
this.inputs = [];
this.outputs = [];
this.nodes = [];
@@ -168,23 +168,23 @@ pickle.Node = class {

pickle.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name.toString();
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

pickle.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new pickle.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer && initializer.type ? initializer.type : type || null;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 2
- 2
source/protobuf.js View File

@@ -474,11 +474,11 @@ protobuf.BinaryReader = class {

protobuf.BufferReader = class extends protobuf.BinaryReader {

constructor(buffer, offset) {
constructor(buffer, offset = 0) {
super();
this._buffer = buffer;
this._length = buffer.length;
this._position = offset || 0;
this._position = offset;
this._view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
}



+ 27
- 0
source/pytorch-metadata.json View File

@@ -7143,6 +7143,33 @@
{
"name": "cadence::quantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "cortex_m::dequantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "cortex_m::maximum.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "cortex_m::minimum.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "cortex_m::quantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "cortex_m::quantized_add.out(Tensor self, Scalar self_zero_point, Scalar self_multiplier, Scalar self_shift, Tensor other, Scalar other_zero_point, Scalar other_multiplier, Scalar other_shift, Scalar output_zero_point, Scalar output_multiplier, Scalar output_shift, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "cortex_m::quantized_conv2d.out(Tensor input, Tensor weight, Tensor? bias, int[] stride, int[] padding, int[] dilation, int input_offset, int output_offset, Tensor requantize_multipliers, Tensor requantize_shifts, int activation_min, int activation_max, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "cortex_m::quantized_linear.out(Tensor input, Tensor weights, Tensor? bias, Tensor? kernel_sum, Scalar input_offset, Scalar filter_offset, Scalar output_offset, int[] requantize_multipliers, int[] requantize_shifts, Scalar activation_max, Scalar activation_min, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "cortex_m::quantized_mul.out(Tensor self, Scalar self_zero_point, Tensor other, Scalar other_zero_point, Scalar output_zero_point, Scalar output_multiplier, Scalar output_shift, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "cortex_m::transpose.out(Tensor input, int[] perm, *, Tensor(a!) out) -> Tensor(a!)"
},
{
"name": "detectron2::nms_rotated(Tensor boxes, Tensor scores, float iou_threshold) -> Tensor"
},


+ 9
- 9
source/pytorch.js View File

@@ -70,11 +70,11 @@ pytorch.Model = class {

pytorch.Graph = class {

constructor(execution, metadata, type, name, module) {
constructor(execution, metadata, type, name = '', module = null) {
this.nodes = [];
this.inputs = [];
this.outputs = [];
this.name = name || '';
this.name = name;
this.type = type;
const values = new Map();
values.map = (name, type, tensor) => {
@@ -321,24 +321,24 @@ pytorch.Graph = class {

pytorch.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

pytorch.Value = class Value {

constructor(name, type, quantization, initializer) {
constructor(name, type, quantization, initializer = null) {
if (typeof name !== 'string') {
throw new pytorch.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer && initializer.type ? initializer.type : type || null;
this.quantization = quantization;
this.initializer = initializer || null;
this.initializer = initializer;
}
};

@@ -982,8 +982,8 @@ pytorch.TensorType = class {

pytorch.TensorShape = class {

constructor(dimensions) {
this.dimensions = dimensions || [];
constructor(dimensions = []) {
this.dimensions = dimensions;
}

toString() {


+ 2
- 2
source/qnn.js View File

@@ -144,11 +144,11 @@ qnn.Graph = class {

qnn.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type;
this.visible = visible !== false;
this.visible = visible;
}
};



+ 3
- 3
source/rknn.js View File

@@ -222,13 +222,13 @@ rknn.Argument = class {

rknn.Value = class {

constructor(name, type, initializer) {
constructor(name, type = null, initializer = null) {
if (typeof name !== 'string') {
throw new rknn.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = type || null;
this.initializer = initializer || null;
this.type = type;
this.initializer = initializer;
}
};



+ 6
- 6
source/sklearn.js View File

@@ -100,8 +100,8 @@ sklearn.Model = class {

sklearn.Module = class {

constructor(metadata, name, obj) {
this.name = name || '';
constructor(metadata, name = '', obj = null) {
this.name = name;
this.nodes = [];
this.inputs = [];
this.outputs = [];
@@ -112,23 +112,23 @@ sklearn.Module = class {

sklearn.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type;
this.visible = visible !== false;
this.visible = visible;
}
};

sklearn.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new sklearn.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 3
- 3
source/tengine.js View File

@@ -61,11 +61,11 @@ tengine.Graph = class {

tengine.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};



+ 10
- 10
source/text.js View File

@@ -91,7 +91,7 @@ text.Decoder.String = class {
text.Decoder.Utf8 = class {

constructor(buffer, position, fatal) {
this.position = position || 0;
this.position = position;
this.buffer = buffer;
this.fatal = fatal;
}
@@ -156,7 +156,7 @@ text.Decoder.Utf8 = class {
text.Decoder.Latin1 = class {

constructor(buffer, position) {
this.position = position || 0;
this.position = position;
this.buffer = buffer;
}

@@ -176,9 +176,9 @@ text.Decoder.Latin1 = class {

text.Decoder.Utf16LE = class {

constructor(buffer, position) {
constructor(buffer, position = 0) {
this.buffer = buffer;
this.position = position || 0;
this.position = position;
this.length = buffer.length;
}

@@ -208,9 +208,9 @@ text.Decoder.Utf16LE = class {

text.Decoder.Utf16BE = class {

constructor(buffer, position) {
constructor(buffer, position = 0) {
this.buffer = buffer;
this.position = position || 0;
this.position = position;
this.length = buffer.length;
}

@@ -240,9 +240,9 @@ text.Decoder.Utf16BE = class {

text.Decoder.Utf32LE = class {

constructor(buffer, position) {
constructor(buffer, position = 0) {
this.buffer = buffer;
this.position = position || 0;
this.position = position;
this.length = buffer.length;
}

@@ -269,9 +269,9 @@ text.Decoder.Utf32LE = class {

text.Decoder.Utf32BE = class {

constructor(buffer, position) {
constructor(buffer, position = 0) {
this.buffer = buffer;
this.position = position || 0;
this.position = position;
this.length = buffer.length;
}



+ 7
- 7
source/tf.js View File

@@ -834,23 +834,23 @@ tf.Signature = class {

tf.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

tf.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new tf.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = !type && initializer ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};

@@ -1110,9 +1110,9 @@ tf.Node = class {

tf.Tensor = class {

constructor(tensor, name, category) {
constructor(tensor, name, category = null) {
this.name = name;
this.category = category || null;
this.category = category;
if (tensor) {
this.type = new tf.TensorType(tensor.dtype, tensor.tensor_shape || tensor.tensorShape);
this._tensor = tensor;


+ 3
- 3
source/tflite.js View File

@@ -403,11 +403,11 @@ tflite.Node = class {

tflite.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};



+ 4
- 4
source/tnn.js View File

@@ -109,23 +109,23 @@ tnn.Graph = class {

tnn.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type;
this.visible = visible !== false;
this.visible = visible;
}
};

tnn.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new tnn.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = initializer ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 3
- 3
source/torch.js View File

@@ -70,11 +70,11 @@ torch.Graph = class {

torch.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};



+ 2
- 2
source/transformers.js View File

@@ -172,10 +172,10 @@ transformers.Object = class {

transformers.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type || null;
this.type = type;
}
};



+ 5
- 5
source/tvm.js View File

@@ -187,23 +187,23 @@ tvm.Graph = class {

tvm.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};

tvm.Value = class {

constructor(name, type, initializer) {
constructor(name, type, initializer = null) {
if (typeof name !== 'string') {
throw new tvm.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = !name && initializer && initializer.name ? initializer.name : name;
this.type = !type && initializer && initializer.type ? initializer.type : type;
this.initializer = initializer || null;
this.initializer = initializer;
}
};



+ 5
- 7
source/uff.js View File

@@ -137,24 +137,22 @@ uff.Graph = class {

uff.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
if (type) {
this.type = type;
}
this.type = type;
}
};

uff.Value = class {

constructor(name, type, initializer) {
constructor(name, type = null, initializer = null) {
if (typeof name !== 'string') {
throw new uff.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = type || null;
this.initializer = initializer || null;
this.type = type;
this.initializer = initializer;
}
};



+ 1
- 1
source/view.js View File

@@ -5578,7 +5578,7 @@ metadata.Attachment.Container = class {

metadata.Argument = class {

constructor(name, value, type) {
constructor(name, value, type = null) {
this.name = name;
this.value = value;
this.type = type;


+ 3
- 3
source/xmodel.js View File

@@ -81,11 +81,11 @@ xmodel.Graph = class {

xmodel.Argument = class {

constructor(name, value, type, visible) {
constructor(name, value, type = null, visible = true) {
this.name = name;
this.value = value;
this.type = type || null;
this.visible = visible !== false;
this.type = type;
this.visible = visible;
}
};



+ 9
- 0
tools/pytorch_script.py View File

@@ -70,6 +70,15 @@ known_legacy_schema_definitions = [
"aten::set_num_threads(int nthreads) -> ()",
"aqlm::code2x8_lut_matmat.out(Tensor input, Tensor codes, Tensor codebooks, Tensor scales, Tensor? bias, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cadence::quantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cortex_m::quantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cortex_m::dequantize_per_tensor.out(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cortex_m::quantized_add.out(Tensor self, Scalar self_zero_point, Scalar self_multiplier, Scalar self_shift, Tensor other, Scalar other_zero_point, Scalar other_multiplier, Scalar other_shift, Scalar output_zero_point, Scalar output_multiplier, Scalar output_shift, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cortex_m::quantized_mul.out(Tensor self, Scalar self_zero_point, Tensor other, Scalar other_zero_point, Scalar output_zero_point, Scalar output_multiplier, Scalar output_shift, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cortex_m::minimum.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cortex_m::maximum.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cortex_m::quantized_linear.out(Tensor input, Tensor weights, Tensor? bias, Tensor? kernel_sum, Scalar input_offset, Scalar filter_offset, Scalar output_offset, int[] requantize_multipliers, int[] requantize_shifts, Scalar activation_max, Scalar activation_min, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cortex_m::transpose.out(Tensor input, int[] perm, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"cortex_m::quantized_conv2d.out(Tensor input, Tensor weight, Tensor? bias, int[] stride, int[] padding, int[] dilation, int input_offset, int output_offset, Tensor requantize_multipliers, Tensor requantize_shifts, int activation_min, int activation_max, *, Tensor(a!) out) -> Tensor(a!)", # noqa E501
"detectron2::nms_rotated(Tensor boxes, Tensor scores, float iou_threshold) -> Tensor", # noqa E501
"detectron2::roi_align_rotated_forward(Tensor input, Tensor rois, float spatial_scale, int pooled_height, int pooled_width, int sampling_ratio) -> Tensor", # noqa E501
"dim_order_ops::_clone_dim_order.out(Tensor self, *, bool non_blocking=False, int[]? dim_order=None, Tensor(a!) out) -> Tensor(a!)", # noqa E501


Loading…
Cancel
Save
Baidu
map