MCPcopy Create free account
hub / github.com/Standard-Intelligence/hertz-dev / CausalConv1d

Class CausalConv1d

tokenizer.py:104–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103
104class CausalConv1d(NonCausalConv1d):
105 def __init__(
106 self,
107 in_channels,
108 out_channels,
109 kernel_size,
110 stride=1,
111 dilation=1,
112 groups=1,
113 bias=True
114 ):
115 super(CausalConv1d, self).__init__(
116 in_channels=in_channels,
117 out_channels=out_channels,
118 kernel_size=kernel_size,
119 stride=stride,
120 padding=0,
121 dilation=dilation,
122 groups=groups,
123 bias=bias,
124 )
125 self.stride = stride
126 self.pad_length = (kernel_size - 1) * dilation
127 def forward(self, x):
128 pad = nn.ConstantPad1d((self.pad_length, 0), 0.0)
129 x = pad(x)
130 return self.conv(x)
131
132
133class CausalConvTranspose1d(NonCausalConvTranspose1d):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected