(key_type, value_type, keys, values)
| 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); |
no test coverage detected