MCPcopy
hub / github.com/descriptinc/descript-audio-codec / get_output_length

Method get_output_length

dac/model/base.py:108–123  ·  view source on GitHub ↗
(self, input_length)

Source from the content-addressed store, hash-verified

106 return (l_in - l_out) // 2
107
108 def get_output_length(self, input_length):
109 L = input_length
110 # Calculate output length
111 for layer in self.modules():
112 if isinstance(layer, (nn.Conv1d, nn.ConvTranspose1d)):
113 d = layer.dilation[0]
114 k = layer.kernel_size[0]
115 s = layer.stride[0]
116
117 if isinstance(layer, nn.Conv1d):
118 L = ((L - d * (k - 1) - 1) / s) + 1
119 elif isinstance(layer, nn.ConvTranspose1d):
120 L = (L - 1) * s + d * (k - 1) + 1
121
122 L = math.floor(L)
123 return L
124
125 @torch.no_grad()
126 def compress(

Callers 2

get_delayMethod · 0.95
compressMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected