本文整理匯總了Python中torch.nn.deconv2DBatchNormRelu方法的典型用法代碼示例。如果您正苦於以下問題:Python nn.deconv2DBatchNormRelu方法的具體用法?Python nn.deconv2DBatchNormRelu怎麽用?Python nn.deconv2DBatchNormRelu使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類torch.nn
的用法示例。
在下文中一共展示了nn.deconv2DBatchNormRelu方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from torch import nn [as 別名]
# 或者: from torch.nn import deconv2DBatchNormRelu [as 別名]
def __init__(self, in_channels, n_filters):
super(linknetUp, self).__init__()
# B, 2C, H, W -> B, C/2, H, W
self.convbnrelu1 = conv2DBatchNormRelu(
in_channels, n_filters / 2, k_size=1, stride=1, padding=1
)
# B, C/2, H, W -> B, C/2, H, W
self.deconvbnrelu2 = nn.deconv2DBatchNormRelu(
n_filters / 2, n_filters / 2, k_size=3, stride=2, padding=0
)
# B, C/2, H, W -> B, C, H, W
self.convbnrelu3 = conv2DBatchNormRelu(
n_filters / 2, n_filters, k_size=1, stride=1, padding=1
)
示例2: __init__
# 需要導入模塊: from torch import nn [as 別名]
# 或者: from torch.nn import deconv2DBatchNormRelu [as 別名]
def __init__(self, in_channels, n_filters, k_size, stride, padding, bias=True):
super(deconv2DBatchNormRelu, self).__init__()
self.dcbr_unit = nn.Sequential(nn.ConvTranspose2d(int(in_channels), int(n_filters), kernel_size=k_size,
padding=padding, stride=stride, bias=bias),
nn.BatchNorm2d(int(n_filters)),
nn.ReLU(inplace=True),)