In MLP.py, this could be a dict lookup (which is faster and easier on the eyes) than a bunch of elifs:
|
for i, vals in enumerate(layers): |
|
print(f"Layer {i}: {vals}") |
|
val, activation = vals |
|
if activation is not None: |
|
if activation == 'relu': |
|
activation = nn.ReLU() |
|
elif activation == 'sigmoid': |
|
activation = nn.Sigmoid() |
|
elif activation == 'tanh': |
|
activation = nn.Tanh() |
|
else: |
|
raise ValueError("Activation function not recognized.") |
|
layers[i] = [val, activation] |
In
MLP.py, this could be adictlookup (which is faster and easier on the eyes) than a bunch ofelifs:MMMAudio/mmm_audio/MLP.py
Lines 71 to 83 in 227da52