No, I don’t think the padding is trainable, at least I’m not aware of a method to learn it.
You might want to look into meta-learning, which can be used to “learn” new architectures and might for your use case. However, I don’t think you can directly use gradient descent to optimize the padding.