Args: nb_kernels (int): the channel of output, also is the number of filters kernel_size (int or tuple): kernel size for two direction of each axis. For example, (2, 3), the first 2 means will add 2 at the beginning and also 2 at the e
(self,
nb_kernels,
kernel_size,
*args,
stride=1,
padding=0,
bias=False)
| 743 | """ |
| 744 | |
| 745 | def __init__(self, |
| 746 | nb_kernels, |
| 747 | kernel_size, |
| 748 | *args, |
| 749 | stride=1, |
| 750 | padding=0, |
| 751 | bias=False): |
| 752 | """ |
| 753 | Args: |
| 754 | nb_kernels (int): the channel of output, also is the number of filters |
| 755 | kernel_size (int or tuple): kernel size for two direction of each |
| 756 | axis. For example, (2, 3), the first 2 means will add 2 at the |
| 757 | beginning and also 2 at the end for its axis.and if a int is |
| 758 | accepted, the kernel size will be initiated as (int, int) |
| 759 | stride (int or tuple): stride, the logic is the same as kernel size. |
| 760 | padding (int): tuple, list or None, padding, the logic is the same |
| 761 | as kernel size. However, if you set pad_mode as "SAME_UPPER" or |
| 762 | "SAME_LOWER" mode, you can set padding as None, and the padding |
| 763 | will be computed automatically. |
| 764 | bias (bool): bias |
| 765 | """ |
| 766 | super(SeparableConv2d, self).__init__() |
| 767 | |
| 768 | # the following code block is for backward compatibility |
| 769 | if len(args) > 0: |
| 770 | nb_kernels = kernel_size |
| 771 | kernel_size = args[0] |
| 772 | if len(args) > 1: |
| 773 | stride = args[1] |
| 774 | if len(args) > 2: |
| 775 | padding = args[2] |
| 776 | |
| 777 | self.nb_kernels = nb_kernels |
| 778 | self.kernel_size = kernel_size |
| 779 | self.stride = stride |
| 780 | self.padding = padding |
| 781 | self.bias = bias |
| 782 | |
| 783 | def initialize(self, x): |
| 784 | self.in_channels = x.shape[1] |