13class Frame:
14 """Represents a "frame" of audio data."""
15
16 def __init__(self, bytes, timestamp, duration): 17 self.bytes = bytes
18 self.timestamp = timestamp
19 self.duration = duration
37 super().__init__()
38 self.inplace = inplace
39
40 def forward(self, input):41 """
42 Forward pass of the function.
43 """
4
5
6# implement mish activation function
7def f_mish(input, inplace=False): 8 """
9 Applies the mish function element-wise:
10 :math:`mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + exp(x)))`
116 self.candidate_layers = candidate_layers # list
117
118 def save_fmaps(key):
119 def forward_hook(module, input, output):120 self.fmap_pool[key] = output.detach()
121
122 return forward_hook
Defining a local variable or function with the same name as a built-in object makes the built-in object unusable within the current scope and makes the code prone to bugs.
dict = {} # dict is a Python builtin!
for idx, student in enumerate(students):
dict[student] = idx
roll_number = {}
for idx, student in enumerate(students):
roll_number[student] = idx