5 ms·
You can almost 1:1 translate this by swapping "tf" and "torch". No need to use nn.Conv2d -- there's a functional API for all these layers: https://pytorch.org/
by apl 6y ago
You can almost 1:1 translate this by swapping "tf" and "torch". No need to use nn.Conv2d -- there's a functional API for all these layers:
https://pytorch.org/docs/master/nn.functional.html#conv2d https://pytorch.org/docs/master/nn.functional.html#conv2d
Torch doesn't have "same" padding, so you have to manually calculate the correct padding value for your input/output shapes.
- 0-_-0 6y agoThat looks great, thanks!