No, this approach won’t work, as you are trying to use a dynamic variable (prePoolDim depends on the actual input size) as the kernel size.
The nn.ConvTranspose3d layer will use the value to initialize the kernel in the desired shape, so changing the kernel shape afterwards would work, if you are directly manipulating the kernel in the forward method. However, to do so, you would need to come up with a strategy how the additional filter values should be filled or how the filter should be sliced.
Transposed conv layers accept an output_size argument to specify the desired spatial output size in case multiple values would be valid.
In case the desired output size is fixed, you could write a wrapper to set it, and then use this custom module in the nn.Sequential container.
However, since it’s dynamic I would avoid using nn.Sequential for the lack of flexibility.