(self,
window_size: int,
output_size: int,
hidden_size: int = 512,
res_hidden_size: int = 512,
num_blocks: int = 5,
dropout: float = 0.1)
| 69 | Output: (N, C, T) the smoothed pose sequence |
| 70 | """ |
| 71 | def __init__(self, |
| 72 | window_size: int, |
| 73 | output_size: int, |
| 74 | hidden_size: int = 512, |
| 75 | res_hidden_size: int = 512, |
| 76 | num_blocks: int = 5, |
| 77 | dropout: float = 0.1): |
| 78 | super().__init__() |
| 79 | self.window_size = window_size |
| 80 | self.output_size = output_size |
| 81 | self.hidden_size = hidden_size |
| 82 | self.res_hidden_size = res_hidden_size |
| 83 | self.num_blocks = num_blocks |
| 84 | self.dropout = dropout |
| 85 | |
| 86 | assert output_size <= window_size, ( |
| 87 | 'The output size should be less than or equal to the window size.', |
| 88 | f' Got output_size=={output_size} and window_size=={window_size}') |
| 89 | |
| 90 | # Build encoder layers |
| 91 | self.encoder = nn.Sequential(nn.Linear(window_size, hidden_size), |
| 92 | nn.LeakyReLU(0.1, inplace=True)) |
| 93 | |
| 94 | # Build residual blocks |
| 95 | res_blocks = [] |
| 96 | for _ in range(num_blocks): |
| 97 | res_blocks.append( |
| 98 | SmoothNetResBlock(in_channels=hidden_size, |
| 99 | hidden_channels=res_hidden_size, |
| 100 | dropout=dropout)) |
| 101 | self.res_blocks = nn.Sequential(*res_blocks) |
| 102 | |
| 103 | # Build decoder layers |
| 104 | self.decoder = nn.Linear(hidden_size, output_size) |
| 105 | |
| 106 | def forward(self, x: Tensor) -> Tensor: |
| 107 | """Forward function.""" |
no test coverage detected