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

you could firstly split the all_nodes_feature tensor to then pad them as sequences. Be aware however that in this case number_of_nodes_in_each_graph should be a normal list of integers.
So you would have: