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

Method createTupleSlice

source/python.js:12281–12293  ·  view source on GitHub ↗
(tup, beg, step_size, num_values)

Source from the content-addressed store, hash-verified

12279 return n;
12280 }
12281 createTupleSlice(tup, beg, step_size, num_values) {
12282 const new_vals = [];
12283 const tt = tup.type().expect(torch.TupleType);
12284 let i = beg;
12285 for (let j = 0; j < num_values; j++) {
12286 const idx = this.insertConstant(new torch._C.IValue(i, 'Int'));
12287 const tupleIndex = this.insertNode(this.createTupleIndex(tup, idx, tt.elements()[i]));
12288 new_vals.push(tupleIndex.output());
12289 i += step_size;
12290 }
12291 const n = this.createTuple(new_vals);
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.');

Callers 1

emitTupleSliceMethod · 0.80

Calls 9

insertConstantMethod · 0.80
insertNodeMethod · 0.80
createTupleIndexMethod · 0.80
elementsMethod · 0.80
createTupleMethod · 0.80
expectMethod · 0.45
typeMethod · 0.45
pushMethod · 0.45
outputMethod · 0.45

Tested by

no test coverage detected