Usually you would add the padding directly to the initialization of the conv layer.
Unfortunately, there is no option to use the 'same' padding argument (there should be some methods to calculate it automatically online for convenience) and you would thus have to calculate the padding manually (as seems to be the case in your CausalConv1d).
However, since you are currently not passing the self.padding to nn.Conv1d, the spatial size of the output might be smaller than the input.