(U: Tensor,
                               x: Tensor,
                               weight_c: Tensor,
                               bias: Tensor,
                               c_init: Tensor,
                               activation_type: int,
                               hidden_size: int,
                               bidirectional: bool,
                               has_skip_term: bool,
                               scale_x: Optional[Tensor] = None,
                               dropout_mask_c: Optional[Tensor] = None,
                               mask_pad: Optional[Tensor] = None,
                               amp_recurrence_fp16: bool = False)
return ElementwiseRecurrence.apply(
        U,
        x,
        weight_c,
        bias,
        c_init,
        activation_type,
        hidden_size,
        bidirectional,
        has_skip_term,
        scale_x,
        dropout_mask_c,
        mask_pad
    )
Elementwise forward operation of SRU on GPU.
Elementwise forward operation of SRU on GPU.
Elementwise forward operation of SRU on GPU .
def elementwise_recurrence_gpu(U: Tensor,
                               x: Tensor,
                               weight_c: Tensor,
                               bias: Tensor,
                               c_init: Tensor,
                               activation_type: int,
                               hidden_size: int,
                               bidirectional: bool,
                               has_skip_term: bool,
                               scale_x: Optional[Tensor] = None,
                               dropout_mask_c: Optional[Tensor] = None,
                               mask_pad: Optional[Tensor] = None,
                               amp_recurrence_fp16: bool = False) -> List[Tensor]:
    """Elementwise forward operation of SRU on GPU.

    """
    from .cuda_functional import ElementwiseRecurrence

    if amp_recurrence_fp16 and U.dtype == torch.float16:
        cast = torch.Tensor.half
    else:
        cast = torch.Tensor.float

    U = cast(U)
    x = cast(x)
    weight_c = cast(weight_c)
    bias = cast(bias)
    c_init = cast(c_init)
    scale_x = cast(scale_x) if scale_x is not None else scale_x
    dropout_mask_c = cast(dropout_mask_c) if dropout_mask_c is not None else dropout_mask_c

    return ElementwiseRecurrence.apply(
        U,
        x,
        weight_c,
        bias,
        c_init,
        activation_type,
        hidden_size,
        bidirectional,
        has_skip_term,
        scale_x,
        dropout_mask_c,
        mask_pad
    )
def elementwise_recurrence_gpu ( U : Tensor , x : Tensor , weight_c : Tensor , bias : Tensor , c_init : Tensor , activation_type : int , hidden_size : int , bidirectional : bool , has_skip_term : bool , scale_x : Optional [ Tensor ] = None , dropout_mask_c : Optional [ Tensor ] = None , mask_pad : Optional [ Tensor ] = None , amp_recurrence_fp16 : bool = False ) -> List [ Tensor ] : from . cuda_functional import ElementwiseRecurrence if amp_recurrence_fp16 and U . dtype == torch . float16 : cast = torch . Tensor . half else : cast = torch . Tensor . float U = cast ( U ) x = cast ( x ) weight_c = cast ( weight_c ) bias = cast ( bias ) c_init = cast ( c_init ) scale_x = cast ( scale_x ) if scale_x is not None else scale_x dropout_mask_c = cast ( dropout_mask_c ) if dropout_mask_c is not None else dropout_mask_c return ElementwiseRecurrence . apply ( U , x , weight_c , bias , c_init , activation_type , hidden_size , bidirectional , has_skip_term , scale_x , dropout_mask_c , mask_pad )