MCPcopy Create free account
hub / github.com/Elsaam2y/DINet_optimized / AudioEncoder

Class AudioEncoder

models/Syncnet.py:207–234  ·  view source on GitHub ↗

audio encoder

Source from the content-addressed store, hash-verified

205
206
207class AudioEncoder(nn.Module):
208 """
209 audio encoder
210 """
211
212 def __init__(self, in_channel, out_dim):
213 super(AudioEncoder, self).__init__()
214 self.in_channel = in_channel
215 self.out_dim = out_dim
216 self.audio_conv = nn.Sequential(
217 SameBlock1d(in_channel, 128, kernel_size=7, padding=3),
218 ResBlock1d(128, 128, 3, 1),
219 # 9-5
220 DownBlock1d(128, 128, 3, 1),
221 ResBlock1d(128, 128, 3, 1),
222 # 5 -3
223 DownBlock1d(128, 128, 3, 1),
224 ResBlock1d(128, 128, 3, 1),
225 # 3-2
226 DownBlock1d(128, 128, 3, 1),
227 SameBlock1d(128, out_dim, kernel_size=3, padding=1),
228 )
229 self.global_avg = nn.AdaptiveAvgPool1d(1)
230
231 def forward(self, x):
232 ## b x c x t
233 out = self.audio_conv(x)
234 return self.global_avg(out).squeeze(2)
235
236
237class SyncNet(nn.Module):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected