You could change it directly by assigning a new value to it:
conv = nn.Conv2d(1, 6, 3, 1, 1, 1)
x = torch.randn(1, 1, 24, 24)
out = conv(x)
print(out.shape)

conv.dilation = (2, 2)
out = conv(x)
print(out.shape)