import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import math
import torch.nn.functional as F
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_poi_fused_mean_sub_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp3 = tmp1 + tmp2
    tmp5 = tmp3 + tmp4
    tmp7 = tmp5 + tmp6
    tmp8 = 4.0
    tmp9 = tmp7 / tmp8
    tmp10 = tmp0 - tmp9
    tl.store(out_ptr0 + x2, tmp10, xmask)


@triton.jit
def triton_poi_fused_add_mean_mul_pow_rsqrt_1(in_ptr0, in_ptr1, in_ptr2,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp18 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp20 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp1 * tmp1
    tmp4 = tmp3 * tmp3
    tmp5 = tmp2 + tmp4
    tmp7 = tmp6 * tmp6
    tmp8 = tmp5 + tmp7
    tmp10 = tmp9 * tmp9
    tmp11 = tmp8 + tmp10
    tmp12 = 4.0
    tmp13 = tmp11 / tmp12
    tmp14 = 1e-05
    tmp15 = tmp13 + tmp14
    tmp16 = libdevice.rsqrt(tmp15)
    tmp17 = tmp0 * tmp16
    tmp19 = tmp17 * tmp18
    tmp21 = tmp19 + tmp20
    tl.store(out_ptr0 + x2, tmp21, xmask)


@triton.jit
def triton_poi_fused_add_2(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tl.store(out_ptr0 + x2, tmp4, xmask)


@triton.jit
def triton_poi_fused_convolution_3(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_out_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x2, tmp2, xmask)


@triton.jit
def triton_poi_fused_clone_4(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex % 16
    x1 = xindex // 4 % 4
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + x3, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tl.store(out_ptr0 + x4, tmp4, xmask)


@triton.jit
def triton_poi_fused_eq_mul_5(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask)
    tmp1 = tmp0 * tmp0
    tmp2 = 0.0
    tmp3 = tmp1 == tmp2
    tl.store(out_ptr0 + x0, tmp3, xmask)


@triton.jit
def triton_poi_fused__softmax_add_div_masked_fill_6(in_ptr0, in_ptr1,
    in_ptr2, out_ptr0, out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex % 16
    x5 = xindex
    x0 = xindex % 4
    x1 = xindex // 4 % 4
    x2 = xindex // 16
    tmp0 = tl.load(in_ptr0 + x3, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp1 = tl.load(in_ptr1 + 4 * x3, xmask, eviction_policy='evict_last')
    tmp20 = tl.load(in_ptr1 + (1 + 4 * x3), xmask, eviction_policy='evict_last'
        )
    tmp25 = tl.load(in_ptr1 + (2 + 4 * x3), xmask, eviction_policy='evict_last'
        )
    tmp30 = tl.load(in_ptr1 + (3 + 4 * x3), xmask, eviction_policy='evict_last'
        )
    tmp2 = x5 % 2
    tl.full([1], 0, tl.int64)
    tmp5 = tl.full([1], 1, tl.int64)
    tmp6 = tmp2 < tmp5
    tmp7 = 0.0
    tmp8 = tl.full(tmp7.shape, 0.0, tmp7.dtype)
    tmp9 = tl.where(tmp6, tmp7, tmp8)
    tmp10 = tmp2 >= tmp5
    tl.full([1], 2, tl.int64)
    tmp13 = tl.load(in_ptr2 + (2 + 4 * x1 + 4 * ((4 + x0) // 8) + 16 * x2 +
        16 * ((4 + x0 + 8 * x1) // 32) + x0 // 2), tmp10 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp14 = tl.where(tmp6, tmp9, tmp13)
    tmp15 = tmp1 + tmp14
    tmp16 = 0.5
    tmp17 = tmp15 * tmp16
    tmp18 = -10000.0
    tmp19 = tl.where(tmp0, tmp18, tmp17)
    tmp21 = tmp20 + tmp14
    tmp22 = tmp21 * tmp16
    tmp23 = tl.where(tmp0, tmp18, tmp22)
    tmp24 = triton_helpers.maximum(tmp19, tmp23)
    tmp26 = tmp25 + tmp14
    tmp27 = tmp26 * tmp16
    tmp28 = tl.where(tmp0, tmp18, tmp27)
    tmp29 = triton_helpers.maximum(tmp24, tmp28)
    tmp31 = tmp30 + tmp14
    tmp32 = tmp31 * tmp16
    tmp33 = tl.where(tmp0, tmp18, tmp32)
    tmp34 = triton_helpers.maximum(tmp29, tmp33)
    tmp35 = tmp19 - tmp34
    tmp36 = tl_math.exp(tmp35)
    tmp37 = tmp23 - tmp34
    tmp38 = tl_math.exp(tmp37)
    tmp39 = tmp36 + tmp38
    tmp40 = tmp28 - tmp34
    tmp41 = tl_math.exp(tmp40)
    tmp42 = tmp39 + tmp41
    tmp43 = tmp33 - tmp34
    tmp44 = tl_math.exp(tmp43)
    tmp45 = tmp42 + tmp44
    tl.store(out_ptr0 + x5, tmp34, xmask)
    tl.store(out_ptr1 + x5, tmp45, xmask)


@triton.jit
def triton_poi_fused__softmax_add_div_masked_fill_7(in_ptr0, in_ptr1,
    in_ptr2, in_ptr3, in_ptr4, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x4 = xindex // 4 % 16
    x5 = xindex % 64
    x7 = xindex
    x1 = xindex // 4 % 4
    x2 = xindex // 16 % 4
    x3 = xindex // 64
    x8 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x4, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp1 = tl.load(in_ptr1 + x5, xmask, eviction_policy='evict_last')
    tmp20 = tl.load(in_ptr3 + x8, xmask, eviction_policy='evict_last')
    tmp23 = tl.load(in_ptr4 + x8, xmask, eviction_policy='evict_last')
    tmp2 = x7 // 4 % 4 % 2
    tl.full([1], 0, tl.int64)
    tmp5 = tl.full([1], 1, tl.int64)
    tmp6 = tmp2 < tmp5
    tmp7 = 0.0
    tmp8 = tl.full(tmp7.shape, 0.0, tmp7.dtype)
    tmp9 = tl.where(tmp6, tmp7, tmp8)
    tmp10 = tmp2 >= tmp5
    tl.full([1], 2, tl.int64)
    tmp13 = tl.load(in_ptr2 + (2 + 4 * x2 + 4 * ((4 + x1) // 8) + 16 * x3 +
        16 * ((4 + x1 + 8 * x2) // 32) + x1 // 2), tmp10 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp14 = tl.where(tmp6, tmp9, tmp13)
    tmp15 = tmp1 + tmp14
    tmp16 = 0.5
    tmp17 = tmp15 * tmp16
    tmp18 = -10000.0
    tmp19 = tl.where(tmp0, tmp18, tmp17)
    tmp21 = tmp19 - tmp20
    tmp22 = tl_math.exp(tmp21)
    tmp24 = tmp22 / tmp23
    tl.store(out_ptr0 + x7, tmp24, xmask)


@triton.jit
def triton_poi_fused_clone_8(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex % 16
    x1 = xindex // 4 % 4
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + x3, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(out_ptr0 + x4, tmp2, xmask)


@triton.jit
def triton_poi_fused_convolution_9(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 16
    tmp0 = tl.load(in_out_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x2, tmp2, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10, primals_11, primals_12,
        primals_13, primals_14, primals_15, primals_16) = args
    args.clear()
    assert_size_stride(primals_1, (4, 4), (4, 1))
    assert_size_stride(primals_2, (4, 4), (4, 1))
    assert_size_stride(primals_3, (4,), (1,))
    assert_size_stride(primals_4, (4,), (1,))
    assert_size_stride(primals_5, (4, 4, 1), (4, 1, 1))
    assert_size_stride(primals_6, (4,), (1,))
    assert_size_stride(primals_7, (4, 4, 1), (4, 1, 1))
    assert_size_stride(primals_8, (4,), (1,))
    assert_size_stride(primals_9, (4, 4, 1), (4, 1, 1))
    assert_size_stride(primals_10, (4,), (1,))
    assert_size_stride(primals_11, (4, 4), (4, 1))
    assert_size_stride(primals_12, (4, 4, 1), (4, 1, 1))
    assert_size_stride(primals_13, (4, 1), (1, 1))
    assert_size_stride(primals_14, (4, 1), (1, 1))
    assert_size_stride(primals_15, (4, 4, 1), (4, 1, 1))
    assert_size_stride(primals_16, (4,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_mean_sub_0[grid(16)](primals_2, buf0, 16, XBLOCK=
            16, num_warps=1, num_stages=1)
        buf1 = empty_strided_cuda((1, 4, 4), (16, 4, 1), torch.float32)
        triton_poi_fused_add_mean_mul_pow_rsqrt_1[grid(16)](buf0, primals_3,
            primals_4, buf1, 16, XBLOCK=16, num_warps=1, num_stages=1)
        del primals_3
        del primals_4
        buf2 = extern_kernels.convolution(buf1, primals_5, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf2, (1, 4, 4), (16, 4, 1))
        buf3 = extern_kernels.convolution(buf1, primals_7, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf3, (1, 4, 4), (16, 4, 1))
        buf4 = extern_kernels.convolution(buf1, primals_9, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf4, (1, 4, 4), (16, 4, 1))
        buf5 = extern_kernels.convolution(reinterpret_tensor(primals_11, (1,
            4, 4), (16, 4, 1), 0), primals_12, stride=(1,), padding=(0,),
            dilation=(1,), transposed=False, output_padding=(0,), groups=1,
            bias=None)
        assert_size_stride(buf5, (1, 4, 4), (16, 4, 1))
        buf6 = reinterpret_tensor(buf0, (1, 4, 1, 4), (16, 4, 4, 1), 0)
        del buf0
        triton_poi_fused_add_2[grid(16)](buf2, primals_6, primals_13, buf6,
            16, XBLOCK=16, num_warps=1, num_stages=1)
        del primals_13
        buf7 = buf3
        del buf3
        triton_poi_fused_convolution_3[grid(16)](buf7, primals_8, 16,
            XBLOCK=16, num_warps=1, num_stages=1)
        del primals_8
        buf8 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf6, (4, 4, 1), (4, 1, 0), 0
            ), reinterpret_tensor(buf7, (4, 1, 4), (4, 0, 1), 0), out=buf8)
        buf9 = empty_strided_cuda((4, 4, 4, 1), (16, 4, 1, 1), torch.float32)
        triton_poi_fused_clone_4[grid(64)](buf2, primals_6, primals_14,
            buf9, 64, XBLOCK=64, num_warps=1, num_stages=1)
        del buf2
        del primals_14
        del primals_6
        buf10 = empty_strided_cuda((16, 4, 1), (4, 1, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf9, (16, 4, 1), (4, 1, 0), 
            0), reinterpret_tensor(buf5, (16, 1, 1), (1, 1, 1), 0), out=buf10)
        buf11 = empty_strided_cuda((4, 4, 1), (4, 1, 1), torch.bool)
        triton_poi_fused_eq_mul_5[grid(16)](primals_1, buf11, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        del primals_1
        buf12 = empty_strided_cuda((4, 4, 4, 1), (16, 4, 1, 64), torch.float32)
        buf13 = empty_strided_cuda((4, 4, 4, 1), (16, 4, 1, 64), torch.float32)
        triton_poi_fused__softmax_add_div_masked_fill_6[grid(64)](buf11,
            buf8, buf10, buf12, buf13, 64, XBLOCK=64, num_warps=1, num_stages=1
            )
        buf14 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused__softmax_add_div_masked_fill_7[grid(256)](buf11,
            buf8, buf10, buf12, buf13, buf14, 256, XBLOCK=256, num_warps=4,
            num_stages=1)
        del buf10
        del buf12
        buf15 = reinterpret_tensor(buf8, (4, 4, 1, 4), (16, 4, 4, 1), 0)
        del buf8
        triton_poi_fused_clone_8[grid(64)](buf4, primals_10, buf15, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        del buf4
        del primals_10
        buf16 = reinterpret_tensor(buf13, (16, 1, 4), (4, 4, 1), 0)
        del buf13
        extern_kernels.bmm(reinterpret_tensor(buf15, (16, 1, 4), (4, 0, 1),
            0), reinterpret_tensor(buf14, (16, 4, 4), (16, 4, 1), 0), out=buf16
            )
        buf17 = extern_kernels.convolution(reinterpret_tensor(buf16, (1, 4,
            16), (64, 16, 1), 0), primals_15, stride=(1,), padding=(0,),
            dilation=(1,), transposed=False, output_padding=(0,), groups=1,
            bias=None)
        assert_size_stride(buf17, (1, 4, 16), (64, 16, 1))
        buf18 = buf17
        del buf17
        triton_poi_fused_convolution_9[grid(64)](buf18, primals_16, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        del primals_16
    return (buf18, primals_2, primals_5, primals_7, primals_9, primals_12,
        primals_15, buf1, reinterpret_tensor(primals_11, (1, 4, 4), (16, 4,
        1), 0), buf11, buf14, reinterpret_tensor(buf16, (1, 4, 16), (64, 16,
        1), 0), reinterpret_tensor(buf15, (16, 4, 1), (4, 1, 4), 0),
        reinterpret_tensor(buf9, (16, 1, 4), (4, 1, 1), 0),
        reinterpret_tensor(buf5, (16, 1, 1), (1, 1, 1), 0),
        reinterpret_tensor(buf6, (4, 1, 4), (4, 4, 1), 0),
        reinterpret_tensor(buf7, (4, 4, 1), (4, 1, 4), 0))


class LayerNorm(nn.Module):

    def __init__(self, channels, eps=1e-05):
        super().__init__()
        self.channels = channels
        self.eps = eps
        self.gamma = nn.Parameter(torch.ones(channels))
        self.beta = nn.Parameter(torch.zeros(channels))

    def forward(self, x):
        mean = torch.mean(x, 1, keepdim=True)
        variance = torch.mean((x - mean) ** 2, 1, keepdim=True)
        x = (x - mean) * torch.rsqrt(variance + self.eps)
        x = x * self.gamma.view(1, -1, 1) + self.beta.view(1, -1, 1)
        return x


class RelativeMultiHeadAttention(nn.Module):

    def __init__(self, channels, num_heads, dropout):
        super(RelativeMultiHeadAttention, self).__init__()
        assert channels % num_heads == 0, 'd_model % num_heads should be zero.'
        self.channels = channels
        self.inner_channels = channels // num_heads
        self.num_heads = num_heads
        self.sqrt_dim = math.sqrt(channels)
        self.query_proj = nn.Conv1d(channels, channels, 1)
        self.key_proj = nn.Conv1d(channels, channels, 1)
        self.value_proj = nn.Conv1d(channels, channels, 1)
        self.pos_proj = nn.Conv1d(channels, channels, 1, bias=False)
        self.dropout = nn.Dropout(p=dropout)
        self.u_bias = nn.Parameter(torch.Tensor(self.num_heads, self.
            inner_channels))
        self.v_bias = nn.Parameter(torch.Tensor(self.num_heads, self.
            inner_channels))
        torch.nn.init.xavier_uniform_(self.u_bias)
        torch.nn.init.xavier_uniform_(self.v_bias)
        self.out_proj = nn.Conv1d(channels, channels, 1)

    def forward(self, query, key, value, pos_embedding, mask=None):
        B = value.size(0)
        query = self.query_proj(query).view(B, self.num_heads, self.
            inner_channels, -1)
        key = self.key_proj(key).view(B, self.num_heads, self.
            inner_channels, -1)
        value = self.value_proj(value).view(B, self.num_heads, self.
            inner_channels, -1)
        B_pos = pos_embedding.size(0)
        pos_emb = self.pos_proj(pos_embedding).view(B_pos, self.num_heads,
            self.inner_channels, -1)
        content_score = torch.matmul((query + self.u_bias[None, :, :, None]
            ).transpose(-1, -2), key)
        pos_score = torch.matmul((query + self.v_bias[None, :, :, None]).
            transpose(-1, -2), pos_emb)
        pos_score = self.rel_shift(pos_score)
        score = (content_score + pos_score) / self.sqrt_dim
        if mask is not None:
            score = score.masked_fill(mask == 0, -10000.0)
        attn_map = F.softmax(score, -1)
        attn = self.dropout(attn_map)
        context = torch.matmul(value, attn)
        context = context.contiguous().view(B, self.channels, -1)
        return self.out_proj(context)

    @staticmethod
    def rel_shift(x):
        B, H, T1, T2 = x.size()
        zero_pad = torch.zeros((B, H, T1, 1), device=x.device, dtype=x.dtype)
        x_padded = torch.cat([zero_pad, x], dim=-1)
        x_padded = x_padded.view(B, H, T2 + 1, T1)
        x = x_padded[:, :, 1:].view_as(x)[:, :, :, :T2 // 2 + 1]
        return x


class RelativeSelfAttentionLayerNew(nn.Module):

    def __init__(self, channels, n_heads, dropout):
        super(RelativeSelfAttentionLayerNew, self).__init__()
        self.norm = LayerNorm(channels)
        self.mha = RelativeMultiHeadAttention(channels, n_heads, dropout)
        self.dropout = nn.Dropout(dropout)

    def forward(self, input_0, input_1, input_2):
        primals_3 = self.norm.gamma
        primals_4 = self.norm.beta
        primals_13 = self.mha.u_bias
        primals_14 = self.mha.v_bias
        primals_5 = self.mha.query_proj.weight
        primals_6 = self.mha.query_proj.bias
        primals_7 = self.mha.key_proj.weight
        primals_8 = self.mha.key_proj.bias
        primals_9 = self.mha.value_proj.weight
        primals_10 = self.mha.value_proj.bias
        primals_12 = self.mha.pos_proj.weight
        primals_15 = self.mha.out_proj.weight
        primals_16 = self.mha.out_proj.bias
        primals_1 = input_0
        primals_2 = input_1
        primals_11 = input_2
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9,
            primals_10, primals_11, primals_12, primals_13, primals_14,
            primals_15, primals_16])
        return output[0]


Measured latency_ms: 0.028189