(
self,
input_size: int,
output_size: int = 256,
attention_heads: int = 4,
linear_units: int = 2048,
num_blocks: int = 6,
tp_blocks: int = 0,
dropout_rate: float = 0.1,
positional_dropout_rate: float = 0.1,
attention_dropout_rate: float = 0.0,
stochastic_depth_rate: float = 0.0,
input_layer: Optional[str] = "conv2d",
pos_enc_class=SinusoidalPositionEncoder,
normalize_before: bool = True,
concat_after: bool = False,
positionwise_layer_type: str = "linear",
positionwise_conv_kernel_size: int = 1,
padding_idx: int = -1,
kernel_size: int = 11,
sanm_shfit: int = 0,
selfattention_layer_type: str = "sanm",
**kwargs,
)
| 443 | """ |
| 444 | |
| 445 | def __init__( |
| 446 | self, |
| 447 | input_size: int, |
| 448 | output_size: int = 256, |
| 449 | attention_heads: int = 4, |
| 450 | linear_units: int = 2048, |
| 451 | num_blocks: int = 6, |
| 452 | tp_blocks: int = 0, |
| 453 | dropout_rate: float = 0.1, |
| 454 | positional_dropout_rate: float = 0.1, |
| 455 | attention_dropout_rate: float = 0.0, |
| 456 | stochastic_depth_rate: float = 0.0, |
| 457 | input_layer: Optional[str] = "conv2d", |
| 458 | pos_enc_class=SinusoidalPositionEncoder, |
| 459 | normalize_before: bool = True, |
| 460 | concat_after: bool = False, |
| 461 | positionwise_layer_type: str = "linear", |
| 462 | positionwise_conv_kernel_size: int = 1, |
| 463 | padding_idx: int = -1, |
| 464 | kernel_size: int = 11, |
| 465 | sanm_shfit: int = 0, |
| 466 | selfattention_layer_type: str = "sanm", |
| 467 | **kwargs, |
| 468 | ): |
| 469 | super().__init__() |
| 470 | self._output_size = output_size |
| 471 | |
| 472 | self.embed = SinusoidalPositionEncoder() |
| 473 | |
| 474 | self.normalize_before = normalize_before |
| 475 | |
| 476 | positionwise_layer = PositionwiseFeedForward |
| 477 | positionwise_layer_args = ( |
| 478 | output_size, |
| 479 | linear_units, |
| 480 | dropout_rate, |
| 481 | ) |
| 482 | |
| 483 | encoder_selfattn_layer = MultiHeadedAttentionSANM |
| 484 | encoder_selfattn_layer_args0 = ( |
| 485 | attention_heads, |
| 486 | input_size, |
| 487 | output_size, |
| 488 | attention_dropout_rate, |
| 489 | kernel_size, |
| 490 | sanm_shfit, |
| 491 | ) |
| 492 | encoder_selfattn_layer_args = ( |
| 493 | attention_heads, |
| 494 | output_size, |
| 495 | output_size, |
| 496 | attention_dropout_rate, |
| 497 | kernel_size, |
| 498 | sanm_shfit, |
| 499 | ) |
| 500 | |
| 501 | self.encoders0 = nn.ModuleList( |
| 502 | [ |
nothing calls this directly
no test coverage detected