MCPcopy
hub / github.com/lutzroeder/netron / createDict

Method createDict

source/python.js:12294–12312  ·  view source on GitHub ↗
(key_type, value_type, keys, values)

Source from the content-addressed store, hash-verified

12292 return n;
12293 }
12294 createDict(key_type, value_type, keys, values) {
12295 if (keys.length !== values.length) {
12296 throw new python.Error('Invalid dictionary size.');
12297 }
12298 const n = this.create('prim::DictConstruct');
12299 const length = keys.length;
12300 for (let i = 0; i < length; i++) {
12301 if (!keys[i].type().isSubtypeOf(key_type)) {
12302 throw new python.Error('Invalid key.');
12303 }
12304 if (!values[i].type().isSubtypeOf(value_type)) {
12305 throw new python.Error('Invalid value.');
12306 }
12307 n.addInput(keys[i]);
12308 n.addInput(values[i]);
12309 }
12310 n.output().setType(torch.DictType.create(key_type, value_type));
12311 return n;
12312 }
12313 createObject(type) {
12314 const node = this.create('prim::CreateObject');
12315 node.output().setType(type);

Callers 1

emitDictLiteralMethod · 0.80

Calls 6

isSubtypeOfMethod · 0.80
addInputMethod · 0.80
setTypeMethod · 0.80
createMethod · 0.45
typeMethod · 0.45
outputMethod · 0.45

Tested by

no test coverage detected