I’m working with graph neural networks and it’s important for my work to perform some padding. Here is the problem -
I have 3 graphs [g1, g2, g3] and each with 1,2,3 nodes respectively. I want to aggregate these nodes such that they are padded with a fixed size. Here is the example
all_nodes_feature = torch.tensor[ 
[1, 1],
[2, 2],
[2, 2],
[3, 3],
[3, 3],
[3, 3] ]

number_of_nodes_in_each_graph = torch.tensor([1, 2, 3])

fixed_length = 3

resulting_output = [ 
[ [1,1], [0, 0], [0,0] ],
[ [2,2], [2, 2], [0,0] ],
[ [3,3], [3, 3], [3,3] ]
]