# 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_4/inductor_cache/a7/ca7arke3s5fg4uhg7akmgqbwrg3d6hnr25qajvo5h3z6zvfwzdiu.py
# Topologically Sorted Source Nodes: [h1], Original ATen: [aten.leaky_relu]
# Source node to ATen node mapping:
#   h1 => gt, mul, where
# Graph fragment:
#   %add_tensor_5 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%mm_default_5, %primals_3), kwargs = {})
#   %gt : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%add_tensor_5, 0), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_tensor_5, 0.01), kwargs = {})
#   %where : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt, %add_tensor_5, %mul), kwargs = {})
triton_poi_fused_leaky_relu_0 = async_compile.triton('triton_poi_fused_leaky_relu_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=[1024], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*i1', 3: '*fp32', 4: '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, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_leaky_relu_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 2, '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_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 800
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 200
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x0), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + (x2), tmp4, xmask)
    tl.store(out_ptr1 + (x2), tmp7, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/ty/ctyzjgbvfzeg3tyzrtqcx6dpy4todpdafudrn2hi3dx7vcb32vbe.py
# Topologically Sorted Source Nodes: [h2], Original ATen: [aten.leaky_relu]
# Source node to ATen node mapping:
#   h2 => gt_1, mul_1, where_1
# Graph fragment:
#   %add_tensor_4 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%mm_default_4, %primals_5), kwargs = {})
#   %gt_1 : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%add_tensor_4, 0), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_tensor_4, 0.01), kwargs = {})
#   %where_1 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %add_tensor_4, %mul_1), kwargs = {})
triton_poi_fused_leaky_relu_1 = async_compile.triton('triton_poi_fused_leaky_relu_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=[512], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*i1', 3: '*fp32', 4: '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, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_leaky_relu_1', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 2, '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_1(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 400
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 100
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x0), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + (x2), tmp4, xmask)
    tl.store(out_ptr1 + (x2), tmp7, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/j4/cj4kjp6w447zzyafnxx5ovroigugqzioy6ifrf5fxiyqnrirfnq5.py
# Topologically Sorted Source Nodes: [h3], Original ATen: [aten.leaky_relu]
# Source node to ATen node mapping:
#   h3 => gt_2, mul_2, where_2
# Graph fragment:
#   %add_tensor_3 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%mm_default_3, %primals_7), kwargs = {})
#   %gt_2 : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%add_tensor_3, 0), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_tensor_3, 0.01), kwargs = {})
#   %where_2 : [num_users=3] = call_function[target=torch.ops.aten.where.self](args = (%gt_2, %add_tensor_3, %mul_2), kwargs = {})
triton_poi_fused_leaky_relu_2 = async_compile.triton('triton_poi_fused_leaky_relu_2', '''
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: '*i1', 3: '*fp32', 4: '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_leaky_relu_2', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 2, '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_2(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 200
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 50
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x0), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + (x2), tmp4, xmask)
    tl.store(out_ptr1 + (x2), tmp7, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/yx/cyxfommvhq7jtntkccbzswxaz6oe2vvfcwxi63gtab4u7vj7aqsn.py
# Topologically Sorted Source Nodes: [mul, std, mul_1, z], Original ATen: [aten.mul, aten.exp, aten.add]
# Source node to ATen node mapping:
#   mul => mul_3
#   mul_1 => mul_4
#   std => exp
#   z => add
# Graph fragment:
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%addmm_4, 0.5), kwargs = {})
#   %exp : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%mul_3,), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%randn, %exp), kwargs = {})
#   %add : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%addmm_3, %mul_4), kwargs = {})
triton_poi_fused_add_exp_mul_3 = async_compile.triton('triton_poi_fused_add_exp_mul_3', '''
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=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '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_exp_mul_3', 'mutated_arg_names': [], '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_exp_mul_3(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 60
    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 = tl.load(in_ptr1 + (x0), xmask)
    tmp2 = tl.load(in_ptr2 + (x0), xmask)
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tl_math.exp(tmp4)
    tmp6 = tmp1 * tmp5
    tmp7 = tmp0 + tmp6
    tl.store(out_ptr0 + (x0), tmp7, 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, 24), (24, 1))
    assert_size_stride(primals_2, (200, 24), (24, 1))
    assert_size_stride(primals_3, (200, ), (1, ))
    assert_size_stride(primals_4, (100, 200), (200, 1))
    assert_size_stride(primals_5, (100, ), (1, ))
    assert_size_stride(primals_6, (50, 100), (100, 1))
    assert_size_stride(primals_7, (50, ), (1, ))
    assert_size_stride(primals_8, (15, 50), (50, 1))
    assert_size_stride(primals_9, (15, ), (1, ))
    assert_size_stride(primals_10, (15, 50), (50, 1))
    assert_size_stride(primals_11, (15, ), (1, ))
    assert_size_stride(primals_12, (50, 15), (15, 1))
    assert_size_stride(primals_13, (50, ), (1, ))
    assert_size_stride(primals_14, (100, 50), (50, 1))
    assert_size_stride(primals_15, (100, ), (1, ))
    assert_size_stride(primals_16, (200, 100), (100, 1))
    assert_size_stride(primals_17, (200, ), (1, ))
    assert_size_stride(primals_18, (24, 200), (200, 1))
    assert_size_stride(primals_19, (24, ), (1, ))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 200), (200, 1), torch.float32)
        # Topologically Sorted Source Nodes: [], Original ATen: []
        extern_kernels.mm(primals_1, reinterpret_tensor(primals_2, (24, 200), (1, 24), 0), out=buf0)
        del primals_2
        buf1 = empty_strided_cuda((4, 200), (200, 1), torch.bool)
        buf2 = empty_strided_cuda((4, 200), (200, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h1], Original ATen: [aten.leaky_relu]
        stream0 = get_raw_stream(0)
        triton_poi_fused_leaky_relu_0.run(buf0, primals_3, buf1, buf2, 800, grid=grid(800), stream=stream0)
        del primals_3
        buf3 = empty_strided_cuda((4, 100), (100, 1), torch.float32)
        # Topologically Sorted Source Nodes: [], Original ATen: []
        extern_kernels.mm(buf2, reinterpret_tensor(primals_4, (200, 100), (1, 200), 0), out=buf3)
        buf4 = empty_strided_cuda((4, 100), (100, 1), torch.bool)
        buf5 = empty_strided_cuda((4, 100), (100, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h2], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_1.run(buf3, primals_5, buf4, buf5, 400, grid=grid(400), stream=stream0)
        del primals_5
        buf6 = empty_strided_cuda((4, 50), (50, 1), torch.float32)
        # Topologically Sorted Source Nodes: [], Original ATen: []
        extern_kernels.mm(buf5, reinterpret_tensor(primals_6, (100, 50), (1, 100), 0), out=buf6)
        buf7 = empty_strided_cuda((4, 50), (50, 1), torch.bool)
        buf8 = empty_strided_cuda((4, 50), (50, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h3], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_2.run(buf6, primals_7, buf7, buf8, 200, grid=grid(200), stream=stream0)
        del primals_7
        buf9 = empty_strided_cuda((4, 15), (15, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mu], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_9, buf8, reinterpret_tensor(primals_8, (50, 15), (1, 50), 0), alpha=1, beta=1, out=buf9)
        del primals_9
        buf10 = empty_strided_cuda((4, 15), (15, 1), torch.float32)
        # Topologically Sorted Source Nodes: [logvar], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_11, buf8, reinterpret_tensor(primals_10, (50, 15), (1, 50), 0), alpha=1, beta=1, out=buf10)
        del primals_11
        # Topologically Sorted Source Nodes: [eps], Original ATen: [aten.randn_like]
        buf11 = torch.ops.aten.randn.default([4, 15], dtype=torch.float32, device=device(type='cuda', index=0), pin_memory=False)
        buf12 = buf11
        del buf11
        buf13 = empty_strided_cuda((4, 15), (15, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul, std, mul_1, z], Original ATen: [aten.mul, aten.exp, aten.add]
        triton_poi_fused_add_exp_mul_3.run(buf9, buf12, buf10, buf13, 60, grid=grid(60), stream=stream0)
        buf14 = buf6; del buf6  # reuse
        # Topologically Sorted Source Nodes: [], Original ATen: []
        extern_kernels.mm(buf13, reinterpret_tensor(primals_12, (15, 50), (1, 15), 0), out=buf14)
        buf15 = empty_strided_cuda((4, 50), (50, 1), torch.bool)
        buf16 = empty_strided_cuda((4, 50), (50, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h4], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_2.run(buf14, primals_13, buf15, buf16, 200, grid=grid(200), stream=stream0)
        del buf14
        del primals_13
        buf17 = buf3; del buf3  # reuse
        # Topologically Sorted Source Nodes: [], Original ATen: []
        extern_kernels.mm(buf16, reinterpret_tensor(primals_14, (50, 100), (1, 50), 0), out=buf17)
        buf18 = empty_strided_cuda((4, 100), (100, 1), torch.bool)
        buf19 = empty_strided_cuda((4, 100), (100, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h5], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_1.run(buf17, primals_15, buf18, buf19, 400, grid=grid(400), stream=stream0)
        del buf17
        del primals_15
        buf20 = buf0; del buf0  # reuse
        # Topologically Sorted Source Nodes: [], Original ATen: []
        extern_kernels.mm(buf19, reinterpret_tensor(primals_16, (100, 200), (1, 100), 0), out=buf20)
        buf21 = empty_strided_cuda((4, 200), (200, 1), torch.bool)
        buf22 = empty_strided_cuda((4, 200), (200, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h6], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_0.run(buf20, primals_17, buf21, buf22, 800, grid=grid(800), stream=stream0)
        del buf20
        del primals_17
        buf23 = empty_strided_cuda((4, 24), (24, 1), torch.float32)
        # Topologically Sorted Source Nodes: [out], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_19, buf22, reinterpret_tensor(primals_18, (200, 24), (1, 200), 0), alpha=1, beta=1, out=buf23)
        del primals_19
    return (buf23, buf9, buf10, primals_1, buf1, buf2, buf4, buf5, buf7, buf8, buf10, buf12, buf13, buf15, buf16, buf18, buf19, buf21, buf22, primals_18, primals_16, primals_14, primals_12, primals_10, primals_8, primals_6, primals_4, )


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, 24), (24, 1), device='cuda:0', dtype=torch.float32)
    primals_2 = rand_strided((200, 24), (24, 1), device='cuda:0', dtype=torch.float32)
    primals_3 = rand_strided((200, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((100, 200), (200, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((100, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((50, 100), (100, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((50, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((15, 50), (50, 1), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((15, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_10 = rand_strided((15, 50), (50, 1), device='cuda:0', dtype=torch.float32)
    primals_11 = rand_strided((15, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_12 = rand_strided((50, 15), (15, 1), device='cuda:0', dtype=torch.float32)
    primals_13 = rand_strided((50, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_14 = rand_strided((100, 50), (50, 1), device='cuda:0', dtype=torch.float32)
    primals_15 = rand_strided((100, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_16 = rand_strided((200, 100), (100, 1), device='cuda:0', dtype=torch.float32)
    primals_17 = rand_strided((200, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_18 = rand_strided((24, 200), (200, 1), device='cuda:0', dtype=torch.float32)
    primals_19 = rand_strided((24, ), (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.utils.data
from torch.nn import functional as F


class VAE(nn.Module):

    def __init__(self, n_features=24, z_dim=15):
        super(VAE, self).__init__()
        self.en1 = nn.Linear(n_features, 200)
        self.en2 = nn.Linear(200, 100)
        self.en3 = nn.Linear(100, 50)
        self.fc_mu = nn.Linear(50, z_dim)
        self.fc_logvar = nn.Linear(50, z_dim)
        self.de1 = nn.Linear(z_dim, 50)
        self.de2 = nn.Linear(50, 100)
        self.de3 = nn.Linear(100, 200)
        self.de4 = nn.Linear(200, n_features)
        self.n_features = n_features
        self.z_dim = z_dim

    def encode(self, x):
        h1 = F.leaky_relu(self.en1(x))
        h2 = F.leaky_relu(self.en2(h1))
        h3 = F.leaky_relu(self.en3(h2))
        return self.fc_mu(h3), self.fc_logvar(h3)

    def reparameterize(self, mu, logvar):
        std = torch.exp(0.5 * logvar)
        eps = torch.randn_like(std)
        return mu + eps * std

    def decode(self, z):
        h4 = F.leaky_relu(self.de1(z))
        h5 = F.leaky_relu(self.de2(h4))
        h6 = F.leaky_relu(self.de3(h5))
        out = self.de4(h6)
        return out

    def forward(self, x):
        mu, logvar = self.encode(x.view(-1, self.n_features))
        z = self.reparameterize(mu, logvar)
        return self.decode(z), mu, logvar


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


def get_init_inputs():
    return [[], {}]

import torch
from torch import device
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.triton_helpers import math as tl_math
import torch.nn as nn
import torch.utils.data
from torch.nn import functional as F
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_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 800
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 200
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x2, tmp4, xmask)
    tl.store(out_ptr1 + x2, tmp7, xmask)


@triton.jit
def triton_poi_fused_leaky_relu_1(in_ptr0, in_ptr1, out_ptr0, out_ptr1,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 400
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 100
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x2, tmp4, xmask)
    tl.store(out_ptr1 + x2, tmp7, xmask)


@triton.jit
def triton_poi_fused_leaky_relu_2(in_ptr0, in_ptr1, out_ptr0, out_ptr1,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 200
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 50
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x2, tmp4, xmask)
    tl.store(out_ptr1 + x2, tmp7, xmask)


@triton.jit
def triton_poi_fused_add_exp_mul_3(in_ptr0, in_ptr1, in_ptr2, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 60
    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 = tl.load(in_ptr1 + x0, xmask)
    tmp2 = tl.load(in_ptr2 + x0, xmask)
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tl_math.exp(tmp4)
    tmp6 = tmp1 * tmp5
    tmp7 = tmp0 + tmp6
    tl.store(out_ptr0 + x0, tmp7, 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, 24), (24, 1))
    assert_size_stride(primals_2, (200, 24), (24, 1))
    assert_size_stride(primals_3, (200,), (1,))
    assert_size_stride(primals_4, (100, 200), (200, 1))
    assert_size_stride(primals_5, (100,), (1,))
    assert_size_stride(primals_6, (50, 100), (100, 1))
    assert_size_stride(primals_7, (50,), (1,))
    assert_size_stride(primals_8, (15, 50), (50, 1))
    assert_size_stride(primals_9, (15,), (1,))
    assert_size_stride(primals_10, (15, 50), (50, 1))
    assert_size_stride(primals_11, (15,), (1,))
    assert_size_stride(primals_12, (50, 15), (15, 1))
    assert_size_stride(primals_13, (50,), (1,))
    assert_size_stride(primals_14, (100, 50), (50, 1))
    assert_size_stride(primals_15, (100,), (1,))
    assert_size_stride(primals_16, (200, 100), (100, 1))
    assert_size_stride(primals_17, (200,), (1,))
    assert_size_stride(primals_18, (24, 200), (200, 1))
    assert_size_stride(primals_19, (24,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 200), (200, 1), torch.float32)
        extern_kernels.mm(primals_1, reinterpret_tensor(primals_2, (24, 200
            ), (1, 24), 0), out=buf0)
        del primals_2
        buf1 = empty_strided_cuda((4, 200), (200, 1), torch.bool)
        buf2 = empty_strided_cuda((4, 200), (200, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_leaky_relu_0[grid(800)](buf0, primals_3, buf1,
            buf2, 800, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_3
        buf3 = empty_strided_cuda((4, 100), (100, 1), torch.float32)
        extern_kernels.mm(buf2, reinterpret_tensor(primals_4, (200, 100), (
            1, 200), 0), out=buf3)
        buf4 = empty_strided_cuda((4, 100), (100, 1), torch.bool)
        buf5 = empty_strided_cuda((4, 100), (100, 1), torch.float32)
        triton_poi_fused_leaky_relu_1[grid(400)](buf3, primals_5, buf4,
            buf5, 400, XBLOCK=128, num_warps=4, num_stages=1)
        del primals_5
        buf6 = empty_strided_cuda((4, 50), (50, 1), torch.float32)
        extern_kernels.mm(buf5, reinterpret_tensor(primals_6, (100, 50), (1,
            100), 0), out=buf6)
        buf7 = empty_strided_cuda((4, 50), (50, 1), torch.bool)
        buf8 = empty_strided_cuda((4, 50), (50, 1), torch.float32)
        triton_poi_fused_leaky_relu_2[grid(200)](buf6, primals_7, buf7,
            buf8, 200, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_7
        buf9 = empty_strided_cuda((4, 15), (15, 1), torch.float32)
        extern_kernels.addmm(primals_9, buf8, reinterpret_tensor(primals_8,
            (50, 15), (1, 50), 0), alpha=1, beta=1, out=buf9)
        del primals_9
        buf10 = empty_strided_cuda((4, 15), (15, 1), torch.float32)
        extern_kernels.addmm(primals_11, buf8, reinterpret_tensor(
            primals_10, (50, 15), (1, 50), 0), alpha=1, beta=1, out=buf10)
        del primals_11
        buf11 = torch.ops.aten.randn.default([4, 15], dtype=torch.float32,
            device=device(type='cuda', index=0), pin_memory=False)
        buf12 = buf11
        del buf11
        buf13 = empty_strided_cuda((4, 15), (15, 1), torch.float32)
        triton_poi_fused_add_exp_mul_3[grid(60)](buf9, buf12, buf10, buf13,
            60, XBLOCK=64, num_warps=1, num_stages=1)
        buf14 = buf6
        del buf6
        extern_kernels.mm(buf13, reinterpret_tensor(primals_12, (15, 50), (
            1, 15), 0), out=buf14)
        buf15 = empty_strided_cuda((4, 50), (50, 1), torch.bool)
        buf16 = empty_strided_cuda((4, 50), (50, 1), torch.float32)
        triton_poi_fused_leaky_relu_2[grid(200)](buf14, primals_13, buf15,
            buf16, 200, XBLOCK=256, num_warps=4, num_stages=1)
        del buf14
        del primals_13
        buf17 = buf3
        del buf3
        extern_kernels.mm(buf16, reinterpret_tensor(primals_14, (50, 100),
            (1, 50), 0), out=buf17)
        buf18 = empty_strided_cuda((4, 100), (100, 1), torch.bool)
        buf19 = empty_strided_cuda((4, 100), (100, 1), torch.float32)
        triton_poi_fused_leaky_relu_1[grid(400)](buf17, primals_15, buf18,
            buf19, 400, XBLOCK=128, num_warps=4, num_stages=1)
        del buf17
        del primals_15
        buf20 = buf0
        del buf0
        extern_kernels.mm(buf19, reinterpret_tensor(primals_16, (100, 200),
            (1, 100), 0), out=buf20)
        buf21 = empty_strided_cuda((4, 200), (200, 1), torch.bool)
        buf22 = empty_strided_cuda((4, 200), (200, 1), torch.float32)
        triton_poi_fused_leaky_relu_0[grid(800)](buf20, primals_17, buf21,
            buf22, 800, XBLOCK=256, num_warps=4, num_stages=1)
        del buf20
        del primals_17
        buf23 = empty_strided_cuda((4, 24), (24, 1), torch.float32)
        extern_kernels.addmm(primals_19, buf22, reinterpret_tensor(
            primals_18, (200, 24), (1, 200), 0), alpha=1, beta=1, out=buf23)
        del primals_19
    return (buf23, buf9, buf10, primals_1, buf1, buf2, buf4, buf5, buf7,
        buf8, buf10, buf12, buf13, buf15, buf16, buf18, buf19, buf21, buf22,
        primals_18, primals_16, primals_14, primals_12, primals_10,
        primals_8, primals_6, primals_4)


class VAENew(nn.Module):

    def __init__(self, n_features=24, z_dim=15):
        super(VAENew, self).__init__()
        self.en1 = nn.Linear(n_features, 200)
        self.en2 = nn.Linear(200, 100)
        self.en3 = nn.Linear(100, 50)
        self.fc_mu = nn.Linear(50, z_dim)
        self.fc_logvar = nn.Linear(50, z_dim)
        self.de1 = nn.Linear(z_dim, 50)
        self.de2 = nn.Linear(50, 100)
        self.de3 = nn.Linear(100, 200)
        self.de4 = nn.Linear(200, n_features)
        self.n_features = n_features
        self.z_dim = z_dim

    def encode(self, x):
        h1 = F.leaky_relu(self.en1(x))
        h2 = F.leaky_relu(self.en2(h1))
        h3 = F.leaky_relu(self.en3(h2))
        return self.fc_mu(h3), self.fc_logvar(h3)

    def reparameterize(self, mu, logvar):
        std = torch.exp(0.5 * logvar)
        eps = torch.randn_like(std)
        return mu + eps * std

    def decode(self, z):
        h4 = F.leaky_relu(self.de1(z))
        h5 = F.leaky_relu(self.de2(h4))
        h6 = F.leaky_relu(self.de3(h5))
        out = self.de4(h6)
        return out

    def forward(self, input_0):
        primals_2 = self.en1.weight
        primals_3 = self.en1.bias
        primals_4 = self.en2.weight
        primals_5 = self.en2.bias
        primals_6 = self.en3.weight
        primals_7 = self.en3.bias
        primals_8 = self.fc_mu.weight
        primals_9 = self.fc_mu.bias
        primals_10 = self.fc_logvar.weight
        primals_11 = self.fc_logvar.bias
        primals_12 = self.de1.weight
        primals_13 = self.de1.bias
        primals_14 = self.de2.weight
        primals_15 = self.de2.bias
        primals_16 = self.de3.weight
        primals_17 = self.de3.bias
        primals_18 = self.de4.weight
        primals_19 = self.de4.bias
        primals_1 = 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], output[1], output[2]
