# AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _align as align
from torch import device, empty_strided
from torch._inductor.async_compile import AsyncCompile
from torch._inductor.select_algorithm import extern_kernels
from torch._inductor.codegen.multi_kernel import MultiKernelCall
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph
from torch._C import _cuda_getCurrentRawStream as get_raw_stream

aten = torch.ops.aten
inductor_ops = torch.ops.inductor
_quantized = torch.ops._quantized
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
alloc_from_pool = torch.ops.inductor._alloc_from_pool
async_compile = AsyncCompile()


# kernel path: runs/run_shard_7/inductor_cache/bv/cbvse5ept7o3o7q5ebn2nxpwr4bf4qljntzo3l7v6jj3xwsc27tt.py
# Topologically Sorted Source Nodes: [leaky_relu], Original ATen: [aten.leaky_relu, aten.leaky_relu_backward]
# Source node to ATen node mapping:
#   leaky_relu => gt, mul, where
# Graph fragment:
#   %gt : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%getitem, 0), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%getitem, 0.01), kwargs = {})
#   %where : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt, %getitem, %mul), kwargs = {})
#   %gt_5 : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%where, 0), kwargs = {})
triton_poi_fused_leaky_relu_leaky_relu_backward_0 = async_compile.triton('triton_poi_fused_leaky_relu_leaky_relu_backward_0', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*i1', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_leaky_relu_leaky_relu_backward_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_leaky_relu_leaky_relu_backward_0(in_out_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 0.01
    tmp4 = tmp0 * tmp3
    tmp5 = tl.where(tmp2, tmp0, tmp4)
    tmp6 = tmp5 > tmp1
    tl.store(in_out_ptr0 + (x0), tmp5, xmask)
    tl.store(out_ptr0 + (x0), tmp6, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/mz/cmz3wjq2uutgv7zzhrquuijmcstklp4wvd4q2ptdi3fpwbjqcpo6.py
# Topologically Sorted Source Nodes: [_output_1], Original ATen: [aten.add]
# Source node to ATen node mapping:
#   _output_1 => add
# Graph fragment:
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%view_4, %getitem_2), kwargs = {})
triton_poi_fused_add_1 = async_compile.triton('triton_poi_fused_add_1', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_1', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 3, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_1(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 4
    tmp0 = tl.load(in_out_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr1 + (x2), xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tl.store(in_out_ptr0 + (x2), tmp4, xmask)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

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, primals_17, primals_18, primals_19 = args
    args.clear()
    assert_size_stride(primals_1, (4, 4), (4, 1))
    assert_size_stride(primals_2, (4, ), (1, ))
    assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    assert_size_stride(primals_5, (4, ), (1, ))
    assert_size_stride(primals_6, (4, 4), (4, 1))
    assert_size_stride(primals_7, (4, ), (1, ))
    assert_size_stride(primals_8, (4, 4), (4, 1))
    assert_size_stride(primals_9, (4, ), (1, ))
    assert_size_stride(primals_10, (4, 4), (4, 1))
    assert_size_stride(primals_11, (4, ), (1, ))
    assert_size_stride(primals_12, (4, 4), (4, 1))
    assert_size_stride(primals_13, (4, ), (1, ))
    assert_size_stride(primals_14, (4, 4), (4, 1))
    assert_size_stride(primals_15, (4, ), (1, ))
    assert_size_stride(primals_16, (4, 4), (4, 1))
    assert_size_stride(primals_17, (4, ), (1, ))
    assert_size_stride(primals_18, (4, 4), (4, 1))
    assert_size_stride(primals_19, (4, ), (1, ))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((64, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_2, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), reinterpret_tensor(primals_1, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf0)
        del primals_1
        del primals_2
        # Topologically Sorted Source Nodes: [dropout], Original ATen: [aten.native_dropout]
        buf1 = torch.ops.aten.native_dropout.default(reinterpret_tensor(buf0, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf2 = buf1[0]
        buf3 = buf1[1]
        del buf1
        buf4 = buf2; del buf2  # reuse
        buf35 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [leaky_relu], Original ATen: [aten.leaky_relu, aten.leaky_relu_backward]
        stream0 = get_raw_stream(0)
        triton_poi_fused_leaky_relu_leaky_relu_backward_0.run(buf4, buf35, 256, grid=grid(256), stream=stream0)
        buf5 = buf0; del buf0  # reuse
        # Topologically Sorted Source Nodes: [], Original ATen: []
        extern_kernels.mm(reinterpret_tensor(buf4, (64, 4), (4, 1), 0), reinterpret_tensor(primals_4, (4, 4), (1, 4), 0), out=buf5)
        buf6 = empty_strided_cuda((64, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear_2], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_7, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), reinterpret_tensor(primals_6, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf6)
        del primals_6
        del primals_7
        # Topologically Sorted Source Nodes: [output], Original ATen: [aten.native_dropout]
        buf7 = torch.ops.aten.native_dropout.default(reinterpret_tensor(buf6, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf8 = buf7[0]
        buf9 = buf7[1]
        del buf7
        buf10 = reinterpret_tensor(buf5, (4, 4, 4, 4), (64, 16, 4, 1), 0); del buf5  # reuse
        # Topologically Sorted Source Nodes: [_output_1], Original ATen: [aten.add]
        triton_poi_fused_add_1.run(buf10, primals_5, buf8, 256, grid=grid(256), stream=stream0)
        del primals_5
        buf11 = reinterpret_tensor(buf8, (64, 4), (4, 1), 0); del buf8  # reuse
        # Topologically Sorted Source Nodes: [linear_3], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_9, reinterpret_tensor(buf10, (64, 4), (4, 1), 0), reinterpret_tensor(primals_8, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf11)
        del primals_9
        # Topologically Sorted Source Nodes: [dropout_2], Original ATen: [aten.native_dropout]
        buf12 = torch.ops.aten.native_dropout.default(reinterpret_tensor(buf11, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf13 = buf12[0]
        buf14 = buf12[1]
        del buf12
        buf15 = buf13; del buf13  # reuse
        buf34 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [leaky_relu_1], Original ATen: [aten.leaky_relu, aten.leaky_relu_backward]
        triton_poi_fused_leaky_relu_leaky_relu_backward_0.run(buf15, buf34, 256, grid=grid(256), stream=stream0)
        buf16 = buf11; del buf11  # reuse
        # Topologically Sorted Source Nodes: [], Original ATen: []
        extern_kernels.mm(reinterpret_tensor(buf15, (64, 4), (4, 1), 0), reinterpret_tensor(primals_10, (4, 4), (1, 4), 0), out=buf16)
        buf17 = buf6; del buf6  # reuse
        # Topologically Sorted Source Nodes: [linear_5], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_13, reinterpret_tensor(buf10, (64, 4), (4, 1), 0), reinterpret_tensor(primals_12, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf17)
        del primals_13
        # Topologically Sorted Source Nodes: [output_1], Original ATen: [aten.native_dropout]
        buf18 = torch.ops.aten.native_dropout.default(reinterpret_tensor(buf17, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf19 = buf18[0]
        buf20 = buf18[1]
        del buf18
        buf21 = reinterpret_tensor(buf16, (4, 4, 4, 4), (64, 16, 4, 1), 0); del buf16  # reuse
        # Topologically Sorted Source Nodes: [_output_3], Original ATen: [aten.add]
        triton_poi_fused_add_1.run(buf21, primals_11, buf19, 256, grid=grid(256), stream=stream0)
        del primals_11
        buf22 = reinterpret_tensor(buf19, (64, 4), (4, 1), 0); del buf19  # reuse
        # Topologically Sorted Source Nodes: [linear_6], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_15, reinterpret_tensor(buf21, (64, 4), (4, 1), 0), reinterpret_tensor(primals_14, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf22)
        del primals_15
        # Topologically Sorted Source Nodes: [dropout_4], Original ATen: [aten.native_dropout]
        buf23 = torch.ops.aten.native_dropout.default(reinterpret_tensor(buf22, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf24 = buf23[0]
        buf25 = buf23[1]
        del buf23
        buf26 = buf24; del buf24  # reuse
        buf33 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [leaky_relu_2], Original ATen: [aten.leaky_relu, aten.leaky_relu_backward]
        triton_poi_fused_leaky_relu_leaky_relu_backward_0.run(buf26, buf33, 256, grid=grid(256), stream=stream0)
        buf27 = buf22; del buf22  # reuse
        # Topologically Sorted Source Nodes: [], Original ATen: []
        extern_kernels.mm(reinterpret_tensor(buf26, (64, 4), (4, 1), 0), reinterpret_tensor(primals_16, (4, 4), (1, 4), 0), out=buf27)
        buf28 = buf17; del buf17  # reuse
        # Topologically Sorted Source Nodes: [linear_8], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_19, reinterpret_tensor(buf21, (64, 4), (4, 1), 0), reinterpret_tensor(primals_18, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf28)
        del primals_19
        # Topologically Sorted Source Nodes: [output_2], Original ATen: [aten.native_dropout]
        buf29 = torch.ops.aten.native_dropout.default(reinterpret_tensor(buf28, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        del buf28
        buf30 = buf29[0]
        buf31 = buf29[1]
        del buf29
        buf32 = reinterpret_tensor(buf27, (4, 4, 4, 4), (64, 16, 4, 1), 0); del buf27  # reuse
        # Topologically Sorted Source Nodes: [_output_5], Original ATen: [aten.add]
        triton_poi_fused_add_1.run(buf32, primals_17, buf30, 256, grid=grid(256), stream=stream0)
        del buf30
        del primals_17
    return (buf32, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), buf3, reinterpret_tensor(buf4, (64, 4), (4, 1), 0), buf9, reinterpret_tensor(buf10, (64, 4), (4, 1), 0), buf14, reinterpret_tensor(buf15, (64, 4), (4, 1), 0), buf20, reinterpret_tensor(buf21, (64, 4), (4, 1), 0), buf25, reinterpret_tensor(buf26, (64, 4), (4, 1), 0), buf31, primals_18, primals_16, buf33, primals_14, primals_12, primals_10, buf34, primals_8, primals_4, buf35, )


def benchmark_compiled_module(times=10, repeat=10):
    from torch._dynamo.testing import rand_strided
    from torch._inductor.utils import print_performance
    primals_1 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_3 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_10 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_11 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_12 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_13 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_14 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_15 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_16 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_17 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_18 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_19 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    fn = lambda: 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, primals_17, primals_18, primals_19])
    return print_performance(fn, times=times, repeat=repeat)


if __name__ == "__main__":
    from torch._inductor.wrapper_benchmark import compiled_module_main
    compiled_module_main('None', benchmark_compiled_module)

import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed


class MConn(nn.Module):
    """ My custom connection module
    """

    def __init__(self, _dim_1, _dim_2, _dim_3, _linear=False, _ln_size=None):
        super(MConn, self).__init__()
        self.linear1 = nn.Linear(_dim_1, _dim_2)
        self.linear2 = nn.Linear(_dim_2, _dim_3)
        if not _linear:
            self.linearw = nn.Linear(_dim_1, _dim_3)
            self.USE_RS = True
        else:
            self.USE_RS = False
        if _ln_size is not None:
            self.layer_norm = nn.LayerNorm(_ln_size)
            self.USE_LN = True
        else:
            self.USE_LN = False

    def forward(self, _input):
        _output = self.linear2(F.leaky_relu(F.dropout(self.linear1(_input),
            p=0.3), inplace=True))
        if self.USE_RS:
            output = F.dropout(self.linearw(_input), p=0.3)
            return self.layer_norm(_output + output
                ) if self.USE_LN else _output + output
        else:
            return self.layer_norm(_output) if self.USE_LN else _output


class MConnBlock(nn.Module):
    """  My custom connection block module
    """

    def __init__(self, _dim_1, _dim_2, _dim_3, _linear=False, _ln_size=None):
        super(MConnBlock, self).__init__()
        _mid_ln_size = (_ln_size[0], _dim_2) if _ln_size else None
        self.MConn1 = MConn(_dim_1, _dim_2, _dim_2, _linear, _mid_ln_size)
        self.MConn6 = MConn(_dim_2, _dim_2, _dim_2, _linear, _mid_ln_size)
        self.MConn7 = MConn(_dim_2, _dim_2, _dim_3, _linear, _ln_size)

    def forward(self, _input):
        _output = self.MConn1(_input)
        _output = self.MConn6(_output)
        _output = self.MConn7(_output)
        return _output


def get_inputs():
    return [torch.rand([4, 4, 4, 4])]


def get_init_inputs():
    return [[], {'_dim_1': 4, '_dim_2': 4, '_dim_3': 4}]

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.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
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_leaky_relu_leaky_relu_backward_0(in_out_ptr0, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_out_ptr0 + x0, xmask)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 0.01
    tmp4 = tmp0 * tmp3
    tmp5 = tl.where(tmp2, tmp0, tmp4)
    tmp6 = tmp5 > tmp1
    tl.store(in_out_ptr0 + x0, tmp5, xmask)
    tl.store(out_ptr0 + x0, tmp6, xmask)


@triton.jit
def triton_poi_fused_add_1(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 4
    tmp0 = tl.load(in_out_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr1 + x2, xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tl.store(in_out_ptr0 + x2, tmp4, 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, primals_17,
        primals_18, primals_19) = args
    args.clear()
    assert_size_stride(primals_1, (4, 4), (4, 1))
    assert_size_stride(primals_2, (4,), (1,))
    assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    assert_size_stride(primals_5, (4,), (1,))
    assert_size_stride(primals_6, (4, 4), (4, 1))
    assert_size_stride(primals_7, (4,), (1,))
    assert_size_stride(primals_8, (4, 4), (4, 1))
    assert_size_stride(primals_9, (4,), (1,))
    assert_size_stride(primals_10, (4, 4), (4, 1))
    assert_size_stride(primals_11, (4,), (1,))
    assert_size_stride(primals_12, (4, 4), (4, 1))
    assert_size_stride(primals_13, (4,), (1,))
    assert_size_stride(primals_14, (4, 4), (4, 1))
    assert_size_stride(primals_15, (4,), (1,))
    assert_size_stride(primals_16, (4, 4), (4, 1))
    assert_size_stride(primals_17, (4,), (1,))
    assert_size_stride(primals_18, (4, 4), (4, 1))
    assert_size_stride(primals_19, (4,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((64, 4), (4, 1), torch.float32)
        extern_kernels.addmm(primals_2, reinterpret_tensor(primals_3, (64, 
            4), (4, 1), 0), reinterpret_tensor(primals_1, (4, 4), (1, 4), 0
            ), alpha=1, beta=1, out=buf0)
        del primals_1
        del primals_2
        buf1 = torch.ops.aten.native_dropout.default(reinterpret_tensor(
            buf0, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf2 = buf1[0]
        buf3 = buf1[1]
        del buf1
        buf4 = buf2
        del buf2
        buf35 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        get_raw_stream(0)
        triton_poi_fused_leaky_relu_leaky_relu_backward_0[grid(256)](buf4,
            buf35, 256, XBLOCK=128, num_warps=4, num_stages=1)
        buf5 = buf0
        del buf0
        extern_kernels.mm(reinterpret_tensor(buf4, (64, 4), (4, 1), 0),
            reinterpret_tensor(primals_4, (4, 4), (1, 4), 0), out=buf5)
        buf6 = empty_strided_cuda((64, 4), (4, 1), torch.float32)
        extern_kernels.addmm(primals_7, reinterpret_tensor(primals_3, (64, 
            4), (4, 1), 0), reinterpret_tensor(primals_6, (4, 4), (1, 4), 0
            ), alpha=1, beta=1, out=buf6)
        del primals_6
        del primals_7
        buf7 = torch.ops.aten.native_dropout.default(reinterpret_tensor(
            buf6, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf8 = buf7[0]
        buf9 = buf7[1]
        del buf7
        buf10 = reinterpret_tensor(buf5, (4, 4, 4, 4), (64, 16, 4, 1), 0)
        del buf5
        triton_poi_fused_add_1[grid(256)](buf10, primals_5, buf8, 256,
            XBLOCK=128, num_warps=4, num_stages=1)
        del primals_5
        buf11 = reinterpret_tensor(buf8, (64, 4), (4, 1), 0)
        del buf8
        extern_kernels.addmm(primals_9, reinterpret_tensor(buf10, (64, 4),
            (4, 1), 0), reinterpret_tensor(primals_8, (4, 4), (1, 4), 0),
            alpha=1, beta=1, out=buf11)
        del primals_9
        buf12 = torch.ops.aten.native_dropout.default(reinterpret_tensor(
            buf11, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf13 = buf12[0]
        buf14 = buf12[1]
        del buf12
        buf15 = buf13
        del buf13
        buf34 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        triton_poi_fused_leaky_relu_leaky_relu_backward_0[grid(256)](buf15,
            buf34, 256, XBLOCK=128, num_warps=4, num_stages=1)
        buf16 = buf11
        del buf11
        extern_kernels.mm(reinterpret_tensor(buf15, (64, 4), (4, 1), 0),
            reinterpret_tensor(primals_10, (4, 4), (1, 4), 0), out=buf16)
        buf17 = buf6
        del buf6
        extern_kernels.addmm(primals_13, reinterpret_tensor(buf10, (64, 4),
            (4, 1), 0), reinterpret_tensor(primals_12, (4, 4), (1, 4), 0),
            alpha=1, beta=1, out=buf17)
        del primals_13
        buf18 = torch.ops.aten.native_dropout.default(reinterpret_tensor(
            buf17, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf19 = buf18[0]
        buf20 = buf18[1]
        del buf18
        buf21 = reinterpret_tensor(buf16, (4, 4, 4, 4), (64, 16, 4, 1), 0)
        del buf16
        triton_poi_fused_add_1[grid(256)](buf21, primals_11, buf19, 256,
            XBLOCK=128, num_warps=4, num_stages=1)
        del primals_11
        buf22 = reinterpret_tensor(buf19, (64, 4), (4, 1), 0)
        del buf19
        extern_kernels.addmm(primals_15, reinterpret_tensor(buf21, (64, 4),
            (4, 1), 0), reinterpret_tensor(primals_14, (4, 4), (1, 4), 0),
            alpha=1, beta=1, out=buf22)
        del primals_15
        buf23 = torch.ops.aten.native_dropout.default(reinterpret_tensor(
            buf22, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        buf24 = buf23[0]
        buf25 = buf23[1]
        del buf23
        buf26 = buf24
        del buf24
        buf33 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        triton_poi_fused_leaky_relu_leaky_relu_backward_0[grid(256)](buf26,
            buf33, 256, XBLOCK=128, num_warps=4, num_stages=1)
        buf27 = buf22
        del buf22
        extern_kernels.mm(reinterpret_tensor(buf26, (64, 4), (4, 1), 0),
            reinterpret_tensor(primals_16, (4, 4), (1, 4), 0), out=buf27)
        buf28 = buf17
        del buf17
        extern_kernels.addmm(primals_19, reinterpret_tensor(buf21, (64, 4),
            (4, 1), 0), reinterpret_tensor(primals_18, (4, 4), (1, 4), 0),
            alpha=1, beta=1, out=buf28)
        del primals_19
        buf29 = torch.ops.aten.native_dropout.default(reinterpret_tensor(
            buf28, (4, 4, 4, 4), (64, 16, 4, 1), 0), 0.3, True)
        del buf28
        buf30 = buf29[0]
        buf31 = buf29[1]
        del buf29
        buf32 = reinterpret_tensor(buf27, (4, 4, 4, 4), (64, 16, 4, 1), 0)
        del buf27
        triton_poi_fused_add_1[grid(256)](buf32, primals_17, buf30, 256,
            XBLOCK=128, num_warps=4, num_stages=1)
        del buf30
        del primals_17
    return (buf32, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), buf3,
        reinterpret_tensor(buf4, (64, 4), (4, 1), 0), buf9,
        reinterpret_tensor(buf10, (64, 4), (4, 1), 0), buf14,
        reinterpret_tensor(buf15, (64, 4), (4, 1), 0), buf20,
        reinterpret_tensor(buf21, (64, 4), (4, 1), 0), buf25,
        reinterpret_tensor(buf26, (64, 4), (4, 1), 0), buf31, primals_18,
        primals_16, buf33, primals_14, primals_12, primals_10, buf34,
        primals_8, primals_4, buf35)


class MConn(nn.Module):
    """ My custom connection module
    """

    def __init__(self, _dim_1, _dim_2, _dim_3, _linear=False, _ln_size=None):
        super(MConn, self).__init__()
        self.linear1 = nn.Linear(_dim_1, _dim_2)
        self.linear2 = nn.Linear(_dim_2, _dim_3)
        if not _linear:
            self.linearw = nn.Linear(_dim_1, _dim_3)
            self.USE_RS = True
        else:
            self.USE_RS = False
        if _ln_size is not None:
            self.layer_norm = nn.LayerNorm(_ln_size)
            self.USE_LN = True
        else:
            self.USE_LN = False

    def forward(self, _input):
        _output = self.linear2(F.leaky_relu(F.dropout(self.linear1(_input),
            p=0.3), inplace=True))
        if self.USE_RS:
            output = F.dropout(self.linearw(_input), p=0.3)
            return self.layer_norm(_output + output
                ) if self.USE_LN else _output + output
        else:
            return self.layer_norm(_output) if self.USE_LN else _output


class MConnBlockNew(nn.Module):
    """  My custom connection block module
    """

    def __init__(self, _dim_1, _dim_2, _dim_3, _linear=False, _ln_size=None):
        super(MConnBlockNew, self).__init__()
        _mid_ln_size = (_ln_size[0], _dim_2) if _ln_size else None
        self.MConn1 = MConn(_dim_1, _dim_2, _dim_2, _linear, _mid_ln_size)
        self.MConn6 = MConn(_dim_2, _dim_2, _dim_2, _linear, _mid_ln_size)
        self.MConn7 = MConn(_dim_2, _dim_2, _dim_3, _linear, _ln_size)

    def forward(self, input_0):
        primals_1 = self.MConn1.linear1.weight
        primals_2 = self.MConn1.linear1.bias
        primals_4 = self.MConn1.linear2.weight
        primals_5 = self.MConn1.linear2.bias
        primals_6 = self.MConn1.linearw.weight
        primals_7 = self.MConn1.linearw.bias
        primals_8 = self.MConn6.linear1.weight
        primals_9 = self.MConn6.linear1.bias
        primals_10 = self.MConn6.linear2.weight
        primals_11 = self.MConn6.linear2.bias
        primals_12 = self.MConn6.linearw.weight
        primals_13 = self.MConn6.linearw.bias
        primals_14 = self.MConn7.linear1.weight
        primals_15 = self.MConn7.linear1.bias
        primals_16 = self.MConn7.linear2.weight
        primals_17 = self.MConn7.linear2.bias
        primals_18 = self.MConn7.linearw.weight
        primals_19 = self.MConn7.linearw.bias
        primals_3 = input_0
        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, primals_17, primals_18, primals_19])
        return output[0]
