r"""3D transposed convolution operation. Only support the case that groups = 1 and conv_mode = "cross_correlation". Refer to :class:`~.ConvTranspose3d` for more information. Args: inp: feature map of the convolution operation. weight: convolution kernel. wei
(
inp: Tensor,
weight: Tensor,
bias: Optional[Tensor] = None,
stride: Union[int, Tuple[int, int, int]] = 1,
padding: Union[int, Tuple[int, int, int]] = 0,
output_padding: Union[int, Tuple[int, int, int]] = 0,
dilation: Union[int, Tuple[int, int, int]] = 1,
groups: int = 1,
)
| 572 | |
| 573 | |
| 574 | def conv_transpose3d( |
| 575 | inp: Tensor, |
| 576 | weight: Tensor, |
| 577 | bias: Optional[Tensor] = None, |
| 578 | stride: Union[int, Tuple[int, int, int]] = 1, |
| 579 | padding: Union[int, Tuple[int, int, int]] = 0, |
| 580 | output_padding: Union[int, Tuple[int, int, int]] = 0, |
| 581 | dilation: Union[int, Tuple[int, int, int]] = 1, |
| 582 | groups: int = 1, |
| 583 | ) -> Tensor: |
| 584 | r"""3D transposed convolution operation. Only support the case that groups = 1 |
| 585 | and conv_mode = "cross_correlation". |
| 586 | |
| 587 | Refer to :class:`~.ConvTranspose3d` for more information. |
| 588 | |
| 589 | Args: |
| 590 | inp: feature map of the convolution operation. |
| 591 | weight: convolution kernel. |
| 592 | weight usually has shape ``(in_channels, out_channels, depth, height, width)``. |
| 593 | bias: bias added to the result of convolution (if given). |
| 594 | stride: stride of the 3D convolution operation. Default: 1 |
| 595 | padding: size of the paddings added to the input on all sides of its |
| 596 | spatial dimensions. Only zero-padding is supported. Default: 0 |
| 597 | output_padding: size of paddings appended to output. Default: 0 |
| 598 | dilation: dilation of the 3D convolution operation. Default: 1 |
| 599 | groups: number of groups into which the input and output channels are divided, |
| 600 | so as to perform a ``grouped convolution``. When ``groups`` is not 1, |
| 601 | ``in_channels`` and ``out_channels`` must be divisible by groups, |
| 602 | and the shape of weight should be ``(groups, in_channels // groups, |
| 603 | out_channels // groups, depth, height, width)``. Default: 1 |
| 604 | |
| 605 | Returns: |
| 606 | output tensor. |
| 607 | """ |
| 608 | D, H, W = 0, 1, 2 |
| 609 | pad = expand_dhw(padding) |
| 610 | stride = expand_dhw(stride) |
| 611 | dilate = expand_dhw(dilation) |
| 612 | output_padding = expand_dhw(output_padding) |
| 613 | |
| 614 | sparse_type = "dense" if groups == 1 else "group" |
| 615 | op = builtin.Convolution3DBackwardData( |
| 616 | pad_d=pad[D], |
| 617 | pad_h=pad[H], |
| 618 | pad_w=pad[W], |
| 619 | stride_d=stride[D], |
| 620 | stride_h=stride[H], |
| 621 | stride_w=stride[W], |
| 622 | dilate_d=dilate[D], |
| 623 | dilate_h=dilate[H], |
| 624 | dilate_w=dilate[W], |
| 625 | strategy=get_execution_strategy(), |
| 626 | sparse=sparse_type, |
| 627 | ) |
| 628 | if output_padding[0] != 0 or output_padding[1] != 0 or output_padding[2] != 0: |
| 629 | assert ( |
| 630 | output_padding[0] < stride[0] |
| 631 | ), "output_padding[0] shoule be less than stride[0]" |
no test coverage detected