Inputting an array of padding values for a batch during training

I am trying to use different padding values with nn.ConstantPad2d function for each image during training. I pass these padding values in the forward function of the network during training, but unlike images I cannot pass them in batches because ConstantPad2d function requires a 0 dimensional input for padding value. Is there a work around for this? How can I use predefined different padding values for each image during the training?