a = list(itertools.product(*[range(m) for _ in range(d)]))
a = torch.LongTensor(a)
adder = torch.LongTensor([0, 2, 4])
a = a + adder
a = a.view(-1)
a = c[a]
a = a.view(8, 3)
print(a)
// a = a.view(-1)
// print(a)
After Change
// Add up indices column-wise, so each column contains independent indices
// ranging globally from 0 to m*d.
a = a + torch.arange(0, d * m, m).long()
// Fill in the spline indices.
a = spline_indices.view(-1)[a.view(-1)].view(m**d, d)