Python torch.nn.functional.conv_transpose3d() Examples
The following are 5
code examples of torch.nn.functional.conv_transpose3d().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
torch.nn.functional
, or try the search function
.
Example #1
Source File: quaternion_ops.py From Pytorch-Quaternion-Neural-Networks with GNU General Public License v3.0 | 6 votes |
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)
Example #2
Source File: quaternion_ops.py From Quaternion-Recurrent-Neural-Networks with GNU General Public License v3.0 | 6 votes |
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)
Example #3
Source File: pairwise.py From airlab with Apache License 2.0 | 5 votes |
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))
Example #4
Source File: stn.py From istn with Apache License 2.0 | 5 votes |
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)
Example #5
Source File: test_pyprof_nvtx.py From apex with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)