File size: 724 Bytes
bb18256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import os, sys
from libs import *

class DSConv1d(nn.Module):
    def __init__(self, 
        in_channels, out_channels, 
        kernel_size, padding = 0, stride = 1, 
    ):
        super(DSConv1d, self).__init__()
        self.dw_conv = nn.Conv1d(
            in_channels, in_channels, 
            kernel_size = kernel_size, padding = padding, stride = stride, 
            groups = in_channels, 
            bias = False, 
        )
        self.pw_conv = nn.Conv1d(
            in_channels, out_channels, 
            kernel_size = 1, 
            bias = False, 
        )

    def forward(self, 
        input, 
    ):
        output = self.dw_conv(input)
        output = self.pw_conv(output)

        return output