How to use the sru.cuda_functional.SRU_Compute_GPU function in sru

To help you get started, we’ve selected a few sru examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asappresearch / sru / sru / cuda_functional.py View on Github external
def __init__(self,
                 activation_type,
                 d_out,
                 bidirectional=False,
                 has_skip_term=True,
                 scale_x=1,
                 mask_pad=None):

        super(SRU_Compute_GPU, self).__init__()
        self.activation_type = activation_type
        self.d_out = d_out
        self.bidirectional = bidirectional
        self.has_skip_term = has_skip_term
        self.scale_x = scale_x
        # ensure mask_pad is a byte tensor
        mask_pad = mask_pad.byte().contiguous() if mask_pad is not None else None
        self.mask_pad = mask_pad