I have this tensor dimension:
(batch_size, class_id, range_indices) -> (4, 3, 2)
int64
[[[1250 1302]
[1324 1374]
[1458 1572]]
[[1911 1955]
[1979 2028]
[2120 2224]]
[[2546 2599]
[2624 2668]
[2765 2871]]
[[3223 3270]
[3286 3347]
[3434 3539]]]
How do I construct densed representation with filled value with this rule:
Since there is 3 class IDs, therefore:
- Class ID 0: filled with 1
- Class ID 1: filled with 2
- Class ID 2: filled with 3
- Default: filled with 0
Therefore, it will outputting vector like this:
[0 0 0 ...(until 1250)... 1 1 1 ...(until 1302)... 0 0 0 ...(until 1324)... 2 2 2 ...(until 1374)... and so on]
Here is copiable code:
data = np.array([[[1250, 1302],
[1324, 1374],
[1458, 1572]],
[[1911, 1955],
[1979, 2028],
[2120, 2224]],
[[2546, 2599],
[2624, 2668],
[2765, 2871]],
[[3223, 3270],
[3286, 3347],
[3434, 3539]]])