DL-Art-School/codes/models/srflow/glow_arch.py
2020-12-18 09:24:31 -07:00

13 lines
429 B
Python

import torch.nn as nn
def f_conv2d_bias(in_channels, out_channels):
def padding_same(kernel, stride):
return [((k - 1) * s + 1) // 2 for k, s in zip(kernel, stride)]
padding = padding_same([3, 3], [1, 1])
assert padding == [1, 1], padding
return nn.Sequential(
nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=[3, 3], stride=1, padding=1,
bias=True))