| 117 | |
| 118 | |
| 119 | class WavenetResidualModule(ModuleBase): |
| 120 | def __init__( |
| 121 | self, |
| 122 | ch_residual, |
| 123 | ch_dilation, |
| 124 | dilation, |
| 125 | kernel_width, |
| 126 | optimizer=None, |
| 127 | init="glorot_uniform", |
| 128 | ): |
| 129 | """ |
| 130 | A WaveNet-like residual block with causal dilated convolutions. |
| 131 | |
| 132 | .. code-block:: text |
| 133 | |
| 134 | *Skip path in* >-------------------------------------------> + ---> *Skip path out* |
| 135 | Causal |--> Tanh --| | |
| 136 | *Main |--> Dilated Conv1D -| * --> 1x1 Conv1D --| |
| 137 | path >--| |--> Sigm --| | |
| 138 | in* |-------------------------------------------------> + ---> *Main path out* |
| 139 | *Residual path* |
| 140 | |
| 141 | On the final block, the output of the skip path is further processed to |
| 142 | produce the network predictions. |
| 143 | |
| 144 | References |
| 145 | ---------- |
| 146 | .. [1] van den Oord et al. (2016). "Wavenet: a generative model for raw |
| 147 | audio". https://arxiv.org/pdf/1609.03499.pdf |
| 148 | |
| 149 | Parameters |
| 150 | ---------- |
| 151 | ch_residual : int |
| 152 | The number of output channels for the 1x1 |
| 153 | :class:`~numpy_ml.neural_nets.layers.Conv1D` layer in the main path. |
| 154 | ch_dilation : int |
| 155 | The number of output channels for the causal dilated |
| 156 | :class:`~numpy_ml.neural_nets.layers.Conv1D` layer in the main path. |
| 157 | dilation : int |
| 158 | The dilation rate for the causal dilated |
| 159 | :class:`~numpy_ml.neural_nets.layers.Conv1D` layer in the main path. |
| 160 | kernel_width : int |
| 161 | The width of the causal dilated |
| 162 | :class:`~numpy_ml.neural_nets.layers.Conv1D` kernel in the main |
| 163 | path. |
| 164 | init : {'glorot_normal', 'glorot_uniform', 'he_normal', 'he_uniform'} |
| 165 | The weight initialization strategy. Default is 'glorot_uniform'. |
| 166 | optimizer : str or :doc:`Optimizer <numpy_ml.neural_nets.optimizers>` object or None |
| 167 | The optimization strategy to use when performing gradient updates |
| 168 | within the :meth:`update` method. If None, use the |
| 169 | :class:`~numpy_ml.neural_nets.optimizers.SGD` optimizer with default |
| 170 | parameters. Default is None. |
| 171 | """ |
| 172 | super().__init__() |
| 173 | |
| 174 | self.init = init |
| 175 | self.dilation = dilation |
| 176 | self.optimizer = optimizer |
no outgoing calls