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

Method getAdjTupleIndex

source/python.js:17851–17861  ·  view source on GitHub ↗
(loc, tuple_type, input_index, allow_out_of_bounds)

Source from the content-addressed store, hash-verified

17849 }
17850 }
17851 getAdjTupleIndex(loc, tuple_type, input_index, allow_out_of_bounds) {
17852 let adj_index = input_index;
17853 const tuple_len = tuple_type.elements().length;
17854 if (input_index < 0) {
17855 adj_index = tuple_len + input_index;
17856 }
17857 if (!allow_out_of_bounds && (adj_index >= tuple_len || adj_index < 0)) {
17858 throw new python.Error(`Tuple index out of range at ${loc}.`);
17859 }
17860 return adj_index;
17861 }
17862 emitTupleIndex(loc, tuple_val, idx_val) {
17863 const tuple_typ = tuple_val.type();
17864 const elems = tuple_typ.elements();

Callers 2

emitTupleIndexMethod · 0.80
emitTupleSliceMethod · 0.80

Calls 1

elementsMethod · 0.80

Tested by

no test coverage detected