I don’t think there’s actually a way of doing it properly . A traditional CNN has fixed kernel sizes, so that you can train every weight at the same time. This ensures that the model is consistent. Assuming that you have a maximum number of kernels and size of kernels, then if you train only part of the kernels and parts of the kernels, it probably breaks the global behaviour of the model.
If you have variable input sizes, I would consider using RNNs instead of CNNs (or combinations of the two). If you have a maximum input size, I think padding with 0s and/or resizing images means that  the activations won’t influence the result.
What kind of data are you working with?