Creating a dictionary with values from 1 to 9 in a 5-digit number range

Hallo All

Have following situation:

  1. Creating of Tensor with values from 1 to 9 in a 5-digit number range
   a = torch.arange(1, 10)
   comb = torch.combinations(a, r=5)
   a = comb.size()
   a = comb.size()
   data = torch.zeros([a[0], a[1]])
   data = comb

it can be also other arange values

Example:

     data([[1, 2, 3, 4, 5],   
           [1, 2, 3, 4, 6],
           [1, 2, 3, 4, 7],
           [1, 2, 3, 4, 8],
            .............
           [5, 6, 7, 8, 9])
  1. the Task: Grouping the Columns by first value and first- digit number,so that we have, create a dictionary

Example:

Number 1 at column 0 can be found at index 0 to 69 in the data[idx]

Nr_1_0: = > index: 0 - 69

Number 2 at column 0 can be found at index 70 to 104

Nr_2_0: => index: 70 - 104

Number 2 at column 1 can be found at index 0 to 34

Nr_2_1: => index 0 - 34

Number 3 at column 0 can be found at index 119 to 105

Nr_3_0: => index 105 - 119

Number 3 at column 1 can be found at index 35 to 54

Nr_3_1: => index 35 - 54

Number 3 at column 2 can be found at index 0 to 14

Nr_3_2: => index 0 - 14

and so one, until number 9 and column 4

more Number

So the Question is : how we can do that without any loops (optimization) ?

Thank you in Advance