当前位置: 首页>>代码示例>>Python>>正文


Python functional.conv_transpose3d方法代码示例

本文整理汇总了Python中torch.nn.functional.conv_transpose3d方法的典型用法代码示例。如果您正苦于以下问题:Python functional.conv_transpose3d方法的具体用法?Python functional.conv_transpose3d怎么用?Python functional.conv_transpose3d使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在torch.nn.functional的用法示例。


在下文中一共展示了functional.conv_transpose3d方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: quaternion_transpose_conv

# 需要导入模块: from torch.nn import functional [as 别名]
# 或者: from torch.nn.functional import conv_transpose3d [as 别名]
def quaternion_transpose_conv(input, r_weight, i_weight, j_weight, k_weight, bias, stride,
                    padding, output_padding, groups, dilatation):
    """
    Applies a quaternion trasposed convolution to the incoming data:

    """

    cat_kernels_4_r = torch.cat([r_weight, -i_weight, -j_weight, -k_weight], dim=1)
    cat_kernels_4_i = torch.cat([i_weight,  r_weight, -k_weight, j_weight], dim=1)
    cat_kernels_4_j = torch.cat([j_weight,  k_weight, r_weight, -i_weight], dim=1)
    cat_kernels_4_k = torch.cat([k_weight,  -j_weight, i_weight, r_weight], dim=1)
    cat_kernels_4_quaternion   = torch.cat([cat_kernels_4_r, cat_kernels_4_i, cat_kernels_4_j, cat_kernels_4_k], dim=0)


    if   input.dim() == 3:
        convfunc = F.conv_transpose1d
    elif input.dim() == 4:
        convfunc = F.conv_transpose2d
    elif input.dim() == 5:
        convfunc = F.conv_transpose3d
    else:
        raise Exception("The convolutional input is either 3, 4 or 5 dimensions."
                        " input.dim = " + str(input.dim()))

    return convfunc(input, cat_kernels_4_quaternion, bias, stride, padding, output_padding, groups, dilatation) 
开发者ID:Orkis-Research,项目名称:Pytorch-Quaternion-Neural-Networks,代码行数:27,代码来源:quaternion_ops.py

示例2: quaternion_transpose_conv

# 需要导入模块: from torch.nn import functional [as 别名]
# 或者: from torch.nn.functional import conv_transpose3d [as 别名]
def quaternion_transpose_conv(input, r_weight, i_weight, j_weight, k_weight, bias, stride, 
                    padding, output_padding, groups, dilatation):
    """
    Applies a quaternion trasposed convolution to the incoming data:

    """

    cat_kernels_4_r = torch.cat([r_weight, -i_weight, -j_weight, -k_weight], dim=1)
    cat_kernels_4_i = torch.cat([i_weight,  r_weight, -k_weight, j_weight], dim=1)
    cat_kernels_4_j = torch.cat([j_weight,  k_weight, r_weight, -i_weight], dim=1)
    cat_kernels_4_k = torch.cat([k_weight,  -j_weight, i_weight, r_weight], dim=1)
    cat_kernels_4_quaternion   = torch.cat([cat_kernels_4_r, cat_kernels_4_i, cat_kernels_4_j, cat_kernels_4_k], dim=0)


    if   input.dim() == 3:
        convfunc = F.conv_transpose1d
    elif input.dim() == 4:
        convfunc = F.conv_transpose2d
    elif input.dim() == 5:
        convfunc = F.conv_transpose3d
    else:
        raise Exception("The convolutional input is either 3, 4 or 5 dimensions."
                        " input.dim = " + str(input.dim()))

    return convfunc(input, cat_kernels_4_quaternion, bias, stride, padding, output_padding, groups, dilatation) 
开发者ID:Orkis-Research,项目名称:Quaternion-Recurrent-Neural-Networks,代码行数:27,代码来源:quaternion_ops.py

示例3: _compute_flow_3d

# 需要导入模块: from torch.nn import functional [as 别名]
# 或者: from torch.nn.functional import conv_transpose3d [as 别名]
def _compute_flow_3d(self):

        # compute dense displacement
        displacement = F.conv_transpose3d(self.trans_parameters, self._kernel,
                                          padding=self._padding, stride=self._stride, groups=3)

        # crop displacement
        return th.squeeze(displacement[:, :, self._stride[0] + self._crop_start[0]:-self._stride[0] - self._crop_end[0],
                                  self._stride[1] + self._crop_start[1]:-self._stride[1] - self._crop_end[1],
                                  self._stride[2] + self._crop_start[2]:-self._stride[2] - self._crop_end[2]
                                  ].transpose_(1,4).transpose_(1,3).transpose_(1,2)) 
开发者ID:airlab-unibas,项目名称:airlab,代码行数:13,代码来源:pairwise.py

示例4: compute_displacement

# 需要导入模块: from torch.nn import functional [as 别名]
# 或者: from torch.nn.functional import conv_transpose3d [as 别名]
def compute_displacement(self, params):
        # compute dense displacement
        displacement = F.conv_transpose3d(params, self.kernel,
                                          padding=self.padding, stride=self.stride, groups=3)

        # crop displacement
        displacement = displacement[:, :,
                       self.control_point_spacing[0] + self.crop_start[0]:-self.control_point_spacing[0] -
                                                                          self.crop_end[0],
                       self.control_point_spacing[1] + self.crop_start[1]:-self.control_point_spacing[1] -
                                                                          self.crop_end[1],
                       self.control_point_spacing[2] + self.crop_start[2]:-self.control_point_spacing[2] -
                                                                          self.crop_end[2]]

        return displacement.permute(0, 2, 3, 4, 1) 
开发者ID:biomedia-mira,项目名称:istn,代码行数:17,代码来源:stn.py

示例5: test_conv_transpose3d

# 需要导入模块: from torch.nn import functional [as 别名]
# 或者: from torch.nn.functional import conv_transpose3d [as 别名]
def test_conv_transpose3d(self):
        # Data and weight tensors
        conv_transpose3d_tensor = torch.randn(20, 16, 50, 10, 20, device='cuda', dtype=self.dtype)
        conv_transpose3d_filter = torch.randn(16, 33, 3, 3, 3, device='cuda', dtype=self.dtype)
        conv_transpose3d_bias = torch.randn(33, device='cuda', dtype=self.dtype)
        # Conv transpose runs
        conv_transpose3d_out = F.conv_transpose3d(conv_transpose3d_tensor, conv_transpose3d_filter)
        conv_transpose3d_out_biased = F.conv_transpose3d(conv_transpose3d_tensor, conv_transpose3d_filter, bias=conv_transpose3d_bias)
        conv_transpose3d_out_strided = F.conv_transpose3d(conv_transpose3d_tensor, conv_transpose3d_filter, stride=2)
        conv_transpose3d_out_padded = F.conv_transpose3d(conv_transpose3d_tensor, conv_transpose3d_filter, padding=3)
        conv_transpose3d_out2_padded = F.conv_transpose3d(conv_transpose3d_tensor, conv_transpose3d_filter, output_padding=2, dilation=3)
        conv_transpose3d_out_grouped = F.conv_transpose3d(conv_transpose3d_tensor, conv_transpose3d_filter, groups=2)
        conv_transpose3d_out_dilated = F.conv_transpose3d(conv_transpose3d_tensor, conv_transpose3d_filter, dilation=2) 
开发者ID:NVIDIA,项目名称:apex,代码行数:15,代码来源:test_pyprof_nvtx.py


注:本文中的torch.nn.functional.conv_transpose3d方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。