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
import torch.utils.data
from torch import 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_clone_0(in_ptr0, in_ptr1, out_ptr0, ynumel, xnumel,
    YBLOCK: tl.constexpr, XBLOCK: tl.constexpr):
    ynumel = 252
    xnumel = 4
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y0 = yindex % 63
    y1 = yindex // 63
    y3 = yindex
    tmp0 = tl.load(in_ptr0 + (y0 + 63 * x2 + 252 * y1), xmask & ymask,
        eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(out_ptr0 + (x2 + 4 * y3), tmp2, xmask & ymask)


def call(args):
    primals_1, primals_2, primals_3, primals_4 = args
    args.clear()
    assert_size_stride(primals_1, (4, 1, 4), (4, 4, 1))
    assert_size_stride(primals_2, (4,), (1,))
    assert_size_stride(primals_3, (4, 1, 64), (64, 64, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = extern_kernels.convolution(primals_3, primals_1, stride=(1,),
            padding=(1,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf0, (4, 4, 63), (252, 63, 1))
        buf1 = empty_strided_cuda((4, 63, 4), (252, 4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_clone_0[grid(252, 4)](buf0, primals_2, buf1, 252, 
            4, XBLOCK=4, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_2
        buf2 = reinterpret_tensor(buf0, (252, 4), (4, 1), 0)
        del buf0
        extern_kernels.mm(reinterpret_tensor(buf1, (252, 4), (4, 1), 0),
            reinterpret_tensor(primals_4, (4, 4), (1, 4), 0), out=buf2)
    return reinterpret_tensor(buf2, (4, 63, 4), (252, 4, 1), 0
        ), primals_1, primals_3, reinterpret_tensor(buf1, (252, 4), (4, 1), 0
        ), primals_4


class LinearNorm(torch.nn.Module):

    def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'):
        super(LinearNorm, self).__init__()
        self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias)

    def forward(self, x):
        return self.linear_layer(x)


class ConvNorm(torch.nn.Module):

    def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
        padding=None, dilation=1, bias=True, w_init_gain='linear'):
        super(ConvNorm, self).__init__()
        if padding is None:
            assert kernel_size % 2 == 1
            padding = int(dilation * (kernel_size - 1) / 2)
        self.conv = torch.nn.Conv1d(in_channels, out_channels, kernel_size=
            kernel_size, stride=stride, padding=padding, dilation=dilation,
            bias=bias)

    def forward(self, signal):
        return self.conv(signal)


class LocationLayerNew(nn.Module):

    def __init__(self, attention_n_filters, attention_kernel_size,
        attention_dim):
        super(LocationLayerNew, self).__init__()
        self.location_conv = ConvNorm(1, attention_n_filters, kernel_size=
            attention_kernel_size, padding=int((attention_kernel_size - 1) /
            2), stride=1, dilation=1)
        self.location_dense = LinearNorm(attention_n_filters, attention_dim,
            bias=False, w_init_gain='tanh')

    def forward(self, input_0):
        primals_1 = self.location_conv.conv.weight
        primals_2 = self.location_conv.conv.bias
        primals_4 = self.location_dense.linear_layer.weight
        primals_3 = input_0
        output = call([primals_1, primals_2, primals_3, primals_4])
        return output[0]


Measured latency_ms: 0.015376