MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / TFReflectionPad1d

Class TFReflectionPad1d

modules/parallel_wavegan/layers/tf_layers.py:11–35  ·  view source on GitHub ↗

Tensorflow ReflectionPad1d module.

Source from the content-addressed store, hash-verified

9
10
11class TFReflectionPad1d(tf.keras.layers.Layer):
12 """Tensorflow ReflectionPad1d module."""
13
14 def __init__(self, padding_size):
15 """Initialize TFReflectionPad1d module.
16
17 Args:
18 padding_size (int): Padding size.
19
20 """
21 super(TFReflectionPad1d, self).__init__()
22 self.padding_size = padding_size
23
24 @tf.function
25 def call(self, x):
26 """Calculate forward propagation.
27
28 Args:
29 x (Tensor): Input tensor (B, T, 1, C).
30
31 Returns:
32 Tensor: Padded tensor (B, T + 2 * padding_size, 1, C).
33
34 """
35 return tf.pad(x, [[0, 0], [self.padding_size, self.padding_size], [0, 0], [0, 0]], "REFLECT")
36
37
38class TFConvTranspose1d(tf.keras.layers.Layer):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected