# 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/ms/cmsuzohbg5nq52jnvirovzkvykrzzko5xomu7zyu5e5u2lhegppw.py
# Topologically Sorted Source Nodes: [state], Original ATen: [aten.cat]
# Source node to ATen node mapping:
#   state => cat
# Graph fragment:
#   %cat : [num_users=3] = call_function[target=torch.ops.aten.cat.default](args = ([%primals_1, %primals_2], 1), kwargs = {})
triton_poi_fused_cat_0 = async_compile.triton('triton_poi_fused_cat_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=[32], 
    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_cat_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_cat_0(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 32
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 8
    x1 = (xindex // 8)
    x2 = xindex
    tmp0 = x0
    tmp1 = tl.full([1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + ((4*x1) + x0), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp6 = tmp0 >= tmp3
    tmp7 = tl.full([1], 8, tl.int64)
    tmp8 = tmp0 < tmp7
    tmp9 = tl.load(in_ptr1 + ((4*x1) + ((-4) + x0)), tmp6 & xmask, eviction_policy='evict_last', other=0.0)
    tmp10 = tl.where(tmp4, tmp5, tmp9)
    tl.store(out_ptr0 + (x2), tmp10, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/f6/cf6m7xarrqhpxj6nailicln5a2l7fgeuvgjr4ehzoadkatavno7u.py
# Topologically Sorted Source Nodes: [q1, q1_1], Original ATen: [aten.elu, aten.native_layer_norm]
# Source node to ATen node mapping:
#   q1 => expm1, gt, mul, mul_2, where
#   q1_1 => add, add_1, mul_3, mul_4, rsqrt, sub, var_mean
# Graph fragment:
#   %gt : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%addmm, 0), kwargs = {})
#   %mul : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%addmm, 1.0), kwargs = {})
#   %expm1 : [num_users=1] = call_function[target=torch.ops.aten.expm1.default](args = (%mul,), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%expm1, 1.0), kwargs = {})
#   %where : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt, %mul, %mul_2), kwargs = {})
#   %var_mean : [num_users=2] = call_function[target=torch.ops.aten.var_mean.correction](args = (%where, [1]), kwargs = {correction: 0, keepdim: True})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%getitem, 1e-05), kwargs = {})
#   %rsqrt : [num_users=2] = call_function[target=torch.ops.aten.rsqrt.default](args = (%add,), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where, %getitem_1), kwargs = {})
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub, %rsqrt), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_3, %primals_5), kwargs = {})
#   %add_1 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_4, %primals_6), kwargs = {})
triton_per_fused_elu_native_layer_norm_1 = async_compile.triton('triton_per_fused_elu_native_layer_norm_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.persistent_reduction(
    size_hints=[4, 512],
    reduction_hint=ReductionHint.INNER,
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 6: 'i32', 7: '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, 5, 7), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused_elu_native_layer_norm_1', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': True, 'num_load': 3, 'num_reduction': 4, '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}
)
@triton.jit
def triton_per_fused_elu_native_layer_norm_1(in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, out_ptr0, out_ptr1, xnumel, rnumel):
    xnumel = 4
    XBLOCK: tl.constexpr = 1
    rnumel = 400
    RBLOCK: tl.constexpr = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    xmask = tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    roffset = 0
    rmask = rindex < rnumel
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + (400*x0)), rmask, other=0.0)
    tmp31 = tl.load(in_ptr1 + (r1), rmask, eviction_policy='evict_last', other=0.0)
    tmp33 = tl.load(in_ptr2 + (r1), rmask, eviction_policy='evict_last', other=0.0)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 1.0
    tmp4 = tmp0 * tmp3
    tmp5 = libdevice.expm1(tmp4)
    tmp6 = tmp5 * tmp3
    tmp7 = tl.where(tmp2, tmp4, tmp6)
    tmp8 = tl.broadcast_to(tmp7, [RBLOCK])
    tmp10 = tl.where(rmask, tmp8, 0)
    tmp11 = tl.broadcast_to(tmp8, [RBLOCK])
    tmp13 = tl.where(rmask, tmp11, 0)
    tmp14 = triton_helpers.promote_to_tensor(tl.sum(tmp13, 0))
    tmp15 = tl.full([1], 400, tl.int32)
    tmp16 = tmp15.to(tl.float32)
    tmp17 = tmp14 / tmp16
    tmp18 = tmp8 - tmp17
    tmp19 = tmp18 * tmp18
    tmp20 = tl.broadcast_to(tmp19, [RBLOCK])
    tmp22 = tl.where(rmask, tmp20, 0)
    tmp23 = triton_helpers.promote_to_tensor(tl.sum(tmp22, 0))
    tmp24 = 400.0
    tmp25 = tmp23 / tmp24
    tmp26 = 1e-05
    tmp27 = tmp25 + tmp26
    tmp28 = libdevice.rsqrt(tmp27)
    tmp29 = tmp7 - tmp17
    tmp30 = tmp29 * tmp28
    tmp32 = tmp30 * tmp31
    tmp34 = tmp32 + tmp33
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (x0), tmp28, None)
    tl.store(out_ptr1 + (r1 + (400*x0)), tmp34, rmask)
    tl.store(out_ptr0 + (x0), tmp17, None)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/cc/ccc2q5giwatmxuksy7ibpscqk4e332w3nn6yajudiywfau2akocy.py
# Topologically Sorted Source Nodes: [q1_2, q1_3], Original ATen: [aten.elu, aten.native_layer_norm]
# Source node to ATen node mapping:
#   q1_2 => expm1_1, gt_1, mul_5, mul_7, where_1
#   q1_3 => add_2, add_3, mul_8, mul_9, rsqrt_1, sub_1, var_mean_1
# Graph fragment:
#   %gt_1 : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%addmm_1, 0), kwargs = {})
#   %mul_5 : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%addmm_1, 1.0), kwargs = {})
#   %expm1_1 : [num_users=1] = call_function[target=torch.ops.aten.expm1.default](args = (%mul_5,), kwargs = {})
#   %mul_7 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%expm1_1, 1.0), kwargs = {})
#   %where_1 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %mul_5, %mul_7), kwargs = {})
#   %var_mean_1 : [num_users=2] = call_function[target=torch.ops.aten.var_mean.correction](args = (%where_1, [1]), kwargs = {correction: 0, keepdim: True})
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%getitem_2, 1e-05), kwargs = {})
#   %rsqrt_1 : [num_users=2] = call_function[target=torch.ops.aten.rsqrt.default](args = (%add_2,), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_1, %getitem_3), kwargs = {})
#   %mul_8 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_1, %rsqrt_1), kwargs = {})
#   %mul_9 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_8, %primals_9), kwargs = {})
#   %add_3 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_9, %primals_10), kwargs = {})
triton_per_fused_elu_native_layer_norm_2 = async_compile.triton('triton_per_fused_elu_native_layer_norm_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.persistent_reduction(
    size_hints=[4, 512],
    reduction_hint=ReductionHint.INNER,
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 6: 'i32', 7: '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, 5), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused_elu_native_layer_norm_2', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': True, 'num_load': 3, 'num_reduction': 4, '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}
)
@triton.jit
def triton_per_fused_elu_native_layer_norm_2(in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, out_ptr0, out_ptr1, xnumel, rnumel):
    xnumel = 4
    XBLOCK: tl.constexpr = 1
    rnumel = 300
    RBLOCK: tl.constexpr = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    xmask = tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    roffset = 0
    rmask = rindex < rnumel
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + (300*x0)), rmask, other=0.0)
    tmp31 = tl.load(in_ptr1 + (r1), rmask, eviction_policy='evict_last', other=0.0)
    tmp33 = tl.load(in_ptr2 + (r1), rmask, eviction_policy='evict_last', other=0.0)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 1.0
    tmp4 = tmp0 * tmp3
    tmp5 = libdevice.expm1(tmp4)
    tmp6 = tmp5 * tmp3
    tmp7 = tl.where(tmp2, tmp4, tmp6)
    tmp8 = tl.broadcast_to(tmp7, [RBLOCK])
    tmp10 = tl.where(rmask, tmp8, 0)
    tmp11 = tl.broadcast_to(tmp8, [RBLOCK])
    tmp13 = tl.where(rmask, tmp11, 0)
    tmp14 = triton_helpers.promote_to_tensor(tl.sum(tmp13, 0))
    tmp15 = tl.full([1], 300, tl.int32)
    tmp16 = tmp15.to(tl.float32)
    tmp17 = tmp14 / tmp16
    tmp18 = tmp8 - tmp17
    tmp19 = tmp18 * tmp18
    tmp20 = tl.broadcast_to(tmp19, [RBLOCK])
    tmp22 = tl.where(rmask, tmp20, 0)
    tmp23 = triton_helpers.promote_to_tensor(tl.sum(tmp22, 0))
    tmp24 = 300.0
    tmp25 = tmp23 / tmp24
    tmp26 = 1e-05
    tmp27 = tmp25 + tmp26
    tmp28 = libdevice.rsqrt(tmp27)
    tmp29 = tmp7 - tmp17
    tmp30 = tmp29 * tmp28
    tmp32 = tmp30 * tmp31
    tmp34 = tmp32 + tmp33
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (x0), tmp28, None)
    tl.store(out_ptr1 + (r1 + (300*x0)), tmp34, rmask)
    tl.store(out_ptr0 + (x0), tmp17, None)
''', 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, primals_20, primals_21, primals_22, primals_23, primals_24, primals_25, primals_26, primals_27, primals_28, primals_29, primals_30, primals_31, primals_32 = 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, (400, 8), (8, 1))
    assert_size_stride(primals_4, (400, ), (1, ))
    assert_size_stride(primals_5, (400, ), (1, ))
    assert_size_stride(primals_6, (400, ), (1, ))
    assert_size_stride(primals_7, (300, 400), (400, 1))
    assert_size_stride(primals_8, (300, ), (1, ))
    assert_size_stride(primals_9, (300, ), (1, ))
    assert_size_stride(primals_10, (300, ), (1, ))
    assert_size_stride(primals_11, (1, 300), (300, 1))
    assert_size_stride(primals_12, (1, ), (1, ))
    assert_size_stride(primals_13, (400, 8), (8, 1))
    assert_size_stride(primals_14, (400, ), (1, ))
    assert_size_stride(primals_15, (400, ), (1, ))
    assert_size_stride(primals_16, (400, ), (1, ))
    assert_size_stride(primals_17, (300, 400), (400, 1))
    assert_size_stride(primals_18, (300, ), (1, ))
    assert_size_stride(primals_19, (300, ), (1, ))
    assert_size_stride(primals_20, (300, ), (1, ))
    assert_size_stride(primals_21, (1, 300), (300, 1))
    assert_size_stride(primals_22, (1, ), (1, ))
    assert_size_stride(primals_23, (400, 4), (4, 1))
    assert_size_stride(primals_24, (400, ), (1, ))
    assert_size_stride(primals_25, (400, ), (1, ))
    assert_size_stride(primals_26, (400, ), (1, ))
    assert_size_stride(primals_27, (300, 400), (400, 1))
    assert_size_stride(primals_28, (300, ), (1, ))
    assert_size_stride(primals_29, (300, ), (1, ))
    assert_size_stride(primals_30, (300, ), (1, ))
    assert_size_stride(primals_31, (1, 300), (300, 1))
    assert_size_stride(primals_32, (1, ), (1, ))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 8), (8, 1), torch.float32)
        # Topologically Sorted Source Nodes: [state], Original ATen: [aten.cat]
        stream0 = get_raw_stream(0)
        triton_poi_fused_cat_0.run(primals_1, primals_2, buf0, 32, grid=grid(32), stream=stream0)
        del primals_2
        buf1 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_4, buf0, reinterpret_tensor(primals_3, (8, 400), (1, 8), 0), alpha=1, beta=1, out=buf1)
        del primals_3
        del primals_4
        buf2 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf3 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf5 = reinterpret_tensor(buf3, (4, 1), (1, 1), 0); del buf3  # reuse
        buf6 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        # Topologically Sorted Source Nodes: [q1, q1_1], Original ATen: [aten.elu, aten.native_layer_norm]
        triton_per_fused_elu_native_layer_norm_1.run(buf5, buf1, primals_5, primals_6, buf2, buf6, 4, 400, grid=grid(4), stream=stream0)
        del primals_6
        buf7 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear_1], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_8, buf6, reinterpret_tensor(primals_7, (400, 300), (1, 400), 0), alpha=1, beta=1, out=buf7)
        del primals_8
        buf8 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf9 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf11 = reinterpret_tensor(buf9, (4, 1), (1, 1), 0); del buf9  # reuse
        buf12 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        # Topologically Sorted Source Nodes: [q1_2, q1_3], Original ATen: [aten.elu, aten.native_layer_norm]
        triton_per_fused_elu_native_layer_norm_2.run(buf11, buf7, primals_9, primals_10, buf8, buf12, 4, 300, grid=grid(4), stream=stream0)
        del primals_10
        buf14 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [q1_4], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_12, buf12, reinterpret_tensor(primals_11, (300, 1), (1, 300), 0), alpha=1, beta=1, out=buf14)
        del primals_12
        buf15 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear_3], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_14, buf0, reinterpret_tensor(primals_13, (8, 400), (1, 8), 0), alpha=1, beta=1, out=buf15)
        del primals_13
        del primals_14
        buf16 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf17 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf19 = reinterpret_tensor(buf17, (4, 1), (1, 1), 0); del buf17  # reuse
        buf20 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        # Topologically Sorted Source Nodes: [q2, q2_1], Original ATen: [aten.elu, aten.native_layer_norm]
        triton_per_fused_elu_native_layer_norm_1.run(buf19, buf15, primals_15, primals_16, buf16, buf20, 4, 400, grid=grid(4), stream=stream0)
        del primals_16
        buf21 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear_4], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_18, buf20, reinterpret_tensor(primals_17, (400, 300), (1, 400), 0), alpha=1, beta=1, out=buf21)
        del primals_18
        buf22 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf23 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf25 = reinterpret_tensor(buf23, (4, 1), (1, 1), 0); del buf23  # reuse
        buf26 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        # Topologically Sorted Source Nodes: [q2_2, q2_3], Original ATen: [aten.elu, aten.native_layer_norm]
        triton_per_fused_elu_native_layer_norm_2.run(buf25, buf21, primals_19, primals_20, buf22, buf26, 4, 300, grid=grid(4), stream=stream0)
        del primals_20
        buf28 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [q2_4], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_22, buf26, reinterpret_tensor(primals_21, (300, 1), (1, 300), 0), alpha=1, beta=1, out=buf28)
        del primals_22
        buf29 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear_6], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_24, primals_1, reinterpret_tensor(primals_23, (4, 400), (1, 4), 0), alpha=1, beta=1, out=buf29)
        del primals_23
        del primals_24
        buf30 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf31 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf33 = reinterpret_tensor(buf31, (4, 1), (1, 1), 0); del buf31  # reuse
        buf34 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        # Topologically Sorted Source Nodes: [v, v_1], Original ATen: [aten.elu, aten.native_layer_norm]
        triton_per_fused_elu_native_layer_norm_1.run(buf33, buf29, primals_25, primals_26, buf30, buf34, 4, 400, grid=grid(4), stream=stream0)
        del primals_26
        buf35 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear_7], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_28, buf34, reinterpret_tensor(primals_27, (400, 300), (1, 400), 0), alpha=1, beta=1, out=buf35)
        del primals_28
        buf36 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf37 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf39 = reinterpret_tensor(buf37, (4, 1), (1, 1), 0); del buf37  # reuse
        buf40 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        # Topologically Sorted Source Nodes: [v_2, v_3], Original ATen: [aten.elu, aten.native_layer_norm]
        triton_per_fused_elu_native_layer_norm_2.run(buf39, buf35, primals_29, primals_30, buf36, buf40, 4, 300, grid=grid(4), stream=stream0)
        del primals_30
        buf42 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [v_4], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_32, buf40, reinterpret_tensor(primals_31, (300, 1), (1, 300), 0), alpha=1, beta=1, out=buf42)
        del primals_32
    return (buf14, buf28, buf42, primals_1, primals_5, primals_9, primals_15, primals_19, primals_25, primals_29, buf0, buf1, buf2, buf5, buf6, buf7, buf8, buf11, buf12, buf15, buf16, buf19, buf20, buf21, buf22, buf25, buf26, buf29, buf30, buf33, buf34, buf35, buf36, buf39, buf40, primals_31, primals_27, primals_21, primals_17, primals_11, primals_7, )


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, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_3 = rand_strided((400, 8), (8, 1), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((400, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((400, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((400, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((300, 400), (400, 1), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((300, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((300, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_10 = rand_strided((300, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_11 = rand_strided((1, 300), (300, 1), device='cuda:0', dtype=torch.float32)
    primals_12 = rand_strided((1, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_13 = rand_strided((400, 8), (8, 1), device='cuda:0', dtype=torch.float32)
    primals_14 = rand_strided((400, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_15 = rand_strided((400, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_16 = rand_strided((400, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_17 = rand_strided((300, 400), (400, 1), device='cuda:0', dtype=torch.float32)
    primals_18 = rand_strided((300, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_19 = rand_strided((300, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_20 = rand_strided((300, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_21 = rand_strided((1, 300), (300, 1), device='cuda:0', dtype=torch.float32)
    primals_22 = rand_strided((1, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_23 = rand_strided((400, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_24 = rand_strided((400, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_25 = rand_strided((400, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_26 = rand_strided((400, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_27 = rand_strided((300, 400), (400, 1), device='cuda:0', dtype=torch.float32)
    primals_28 = rand_strided((300, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_29 = rand_strided((300, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_30 = rand_strided((300, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_31 = rand_strided((1, 300), (300, 1), device='cuda:0', dtype=torch.float32)
    primals_32 = rand_strided((1, ), (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, primals_20, primals_21, primals_22, primals_23, primals_24, primals_25, primals_26, primals_27, primals_28, primals_29, primals_30, primals_31, primals_32])
    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
from torch import nn
import torch.nn.functional as F


class Critic(nn.Module):
    """Critic model

        Parameters:
              args (object): Parameter class

    """

    def __init__(self, state_dim, action_dim):
        super(Critic, self).__init__()
        l1 = 400
        l2 = 300
        self.q1f1 = nn.Linear(state_dim + action_dim, l1)
        self.q1ln1 = nn.LayerNorm(l1)
        self.q1f2 = nn.Linear(l1, l2)
        self.q1ln2 = nn.LayerNorm(l2)
        self.q1out = nn.Linear(l2, 1)
        self.q2f1 = nn.Linear(state_dim + action_dim, l1)
        self.q2ln1 = nn.LayerNorm(l1)
        self.q2f2 = nn.Linear(l1, l2)
        self.q2ln2 = nn.LayerNorm(l2)
        self.q2out = nn.Linear(l2, 1)
        self.vf1 = nn.Linear(state_dim, l1)
        self.vln1 = nn.LayerNorm(l1)
        self.vf2 = nn.Linear(l1, l2)
        self.vln2 = nn.LayerNorm(l2)
        self.vout = nn.Linear(l2, 1)

    def forward(self, obs, action):
        """Method to forward propagate through the critic's graph

             Parameters:
                   input (tensor): states
                   input (tensor): actions

             Returns:
                   Q1 (tensor): Qval 1
                   Q2 (tensor): Qval 2
                   V (tensor): Value



         """
        state = torch.cat([obs, action], 1)
        q1 = F.elu(self.q1f1(state))
        q1 = self.q1ln1(q1)
        q1 = F.elu(self.q1f2(q1))
        q1 = self.q1ln2(q1)
        q1 = self.q1out(q1)
        q2 = F.elu(self.q2f1(state))
        q2 = self.q2ln1(q2)
        q2 = F.elu(self.q2f2(q2))
        q2 = self.q2ln2(q2)
        q2 = self.q2out(q2)
        v = F.elu(self.vf1(obs))
        v = self.vln1(v)
        v = F.elu(self.vf2(v))
        v = self.vln2(v)
        v = self.vout(v)
        return q1, q2, v


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


def get_init_inputs():
    return [[], {'state_dim': 4, 'action_dim': 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
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_cat_0(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 32
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 8
    x1 = xindex // 8
    x2 = xindex
    tmp0 = x0
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (4 * x1 + x0), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp6 = tmp0 >= tmp3
    tl.full([1], 8, tl.int64)
    tmp9 = tl.load(in_ptr1 + (4 * x1 + (-4 + x0)), tmp6 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp10 = tl.where(tmp4, tmp5, tmp9)
    tl.store(out_ptr0 + x2, tmp10, xmask)


@triton.jit
def triton_per_fused_elu_native_layer_norm_1(in_out_ptr0, in_ptr0, in_ptr1,
    in_ptr2, out_ptr0, out_ptr1, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    rnumel = 400
    RBLOCK: tl.constexpr = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    rmask = rindex < rnumel
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 400 * x0), rmask, other=0.0)
    tmp31 = tl.load(in_ptr1 + r1, rmask, eviction_policy='evict_last',
        other=0.0)
    tmp33 = tl.load(in_ptr2 + r1, rmask, eviction_policy='evict_last',
        other=0.0)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 1.0
    tmp4 = tmp0 * tmp3
    tmp5 = libdevice.expm1(tmp4)
    tmp6 = tmp5 * tmp3
    tmp7 = tl.where(tmp2, tmp4, tmp6)
    tmp8 = tl.broadcast_to(tmp7, [RBLOCK])
    tl.where(rmask, tmp8, 0)
    tmp11 = tl.broadcast_to(tmp8, [RBLOCK])
    tmp13 = tl.where(rmask, tmp11, 0)
    tmp14 = triton_helpers.promote_to_tensor(tl.sum(tmp13, 0))
    tmp15 = tl.full([1], 400, tl.int32)
    tmp16 = tmp15.to(tl.float32)
    tmp17 = tmp14 / tmp16
    tmp18 = tmp8 - tmp17
    tmp19 = tmp18 * tmp18
    tmp20 = tl.broadcast_to(tmp19, [RBLOCK])
    tmp22 = tl.where(rmask, tmp20, 0)
    tmp23 = triton_helpers.promote_to_tensor(tl.sum(tmp22, 0))
    tmp24 = 400.0
    tmp25 = tmp23 / tmp24
    tmp26 = 1e-05
    tmp27 = tmp25 + tmp26
    tmp28 = libdevice.rsqrt(tmp27)
    tmp29 = tmp7 - tmp17
    tmp30 = tmp29 * tmp28
    tmp32 = tmp30 * tmp31
    tmp34 = tmp32 + tmp33
    tl.debug_barrier()
    tl.store(in_out_ptr0 + x0, tmp28, None)
    tl.store(out_ptr1 + (r1 + 400 * x0), tmp34, rmask)
    tl.store(out_ptr0 + x0, tmp17, None)


@triton.jit
def triton_per_fused_elu_native_layer_norm_2(in_out_ptr0, in_ptr0, in_ptr1,
    in_ptr2, out_ptr0, out_ptr1, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    rnumel = 300
    RBLOCK: tl.constexpr = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    rmask = rindex < rnumel
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 300 * x0), rmask, other=0.0)
    tmp31 = tl.load(in_ptr1 + r1, rmask, eviction_policy='evict_last',
        other=0.0)
    tmp33 = tl.load(in_ptr2 + r1, rmask, eviction_policy='evict_last',
        other=0.0)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 1.0
    tmp4 = tmp0 * tmp3
    tmp5 = libdevice.expm1(tmp4)
    tmp6 = tmp5 * tmp3
    tmp7 = tl.where(tmp2, tmp4, tmp6)
    tmp8 = tl.broadcast_to(tmp7, [RBLOCK])
    tl.where(rmask, tmp8, 0)
    tmp11 = tl.broadcast_to(tmp8, [RBLOCK])
    tmp13 = tl.where(rmask, tmp11, 0)
    tmp14 = triton_helpers.promote_to_tensor(tl.sum(tmp13, 0))
    tmp15 = tl.full([1], 300, tl.int32)
    tmp16 = tmp15.to(tl.float32)
    tmp17 = tmp14 / tmp16
    tmp18 = tmp8 - tmp17
    tmp19 = tmp18 * tmp18
    tmp20 = tl.broadcast_to(tmp19, [RBLOCK])
    tmp22 = tl.where(rmask, tmp20, 0)
    tmp23 = triton_helpers.promote_to_tensor(tl.sum(tmp22, 0))
    tmp24 = 300.0
    tmp25 = tmp23 / tmp24
    tmp26 = 1e-05
    tmp27 = tmp25 + tmp26
    tmp28 = libdevice.rsqrt(tmp27)
    tmp29 = tmp7 - tmp17
    tmp30 = tmp29 * tmp28
    tmp32 = tmp30 * tmp31
    tmp34 = tmp32 + tmp33
    tl.debug_barrier()
    tl.store(in_out_ptr0 + x0, tmp28, None)
    tl.store(out_ptr1 + (r1 + 300 * x0), tmp34, rmask)
    tl.store(out_ptr0 + x0, tmp17, None)


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, primals_20, primals_21, primals_22,
        primals_23, primals_24, primals_25, primals_26, primals_27,
        primals_28, primals_29, primals_30, primals_31, primals_32) = 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, (400, 8), (8, 1))
    assert_size_stride(primals_4, (400,), (1,))
    assert_size_stride(primals_5, (400,), (1,))
    assert_size_stride(primals_6, (400,), (1,))
    assert_size_stride(primals_7, (300, 400), (400, 1))
    assert_size_stride(primals_8, (300,), (1,))
    assert_size_stride(primals_9, (300,), (1,))
    assert_size_stride(primals_10, (300,), (1,))
    assert_size_stride(primals_11, (1, 300), (300, 1))
    assert_size_stride(primals_12, (1,), (1,))
    assert_size_stride(primals_13, (400, 8), (8, 1))
    assert_size_stride(primals_14, (400,), (1,))
    assert_size_stride(primals_15, (400,), (1,))
    assert_size_stride(primals_16, (400,), (1,))
    assert_size_stride(primals_17, (300, 400), (400, 1))
    assert_size_stride(primals_18, (300,), (1,))
    assert_size_stride(primals_19, (300,), (1,))
    assert_size_stride(primals_20, (300,), (1,))
    assert_size_stride(primals_21, (1, 300), (300, 1))
    assert_size_stride(primals_22, (1,), (1,))
    assert_size_stride(primals_23, (400, 4), (4, 1))
    assert_size_stride(primals_24, (400,), (1,))
    assert_size_stride(primals_25, (400,), (1,))
    assert_size_stride(primals_26, (400,), (1,))
    assert_size_stride(primals_27, (300, 400), (400, 1))
    assert_size_stride(primals_28, (300,), (1,))
    assert_size_stride(primals_29, (300,), (1,))
    assert_size_stride(primals_30, (300,), (1,))
    assert_size_stride(primals_31, (1, 300), (300, 1))
    assert_size_stride(primals_32, (1,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 8), (8, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_cat_0[grid(32)](primals_1, primals_2, buf0, 32,
            XBLOCK=32, num_warps=1, num_stages=1)
        del primals_2
        buf1 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        extern_kernels.addmm(primals_4, buf0, reinterpret_tensor(primals_3,
            (8, 400), (1, 8), 0), alpha=1, beta=1, out=buf1)
        del primals_3
        del primals_4
        buf2 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf3 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf5 = reinterpret_tensor(buf3, (4, 1), (1, 1), 0)
        del buf3
        buf6 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        triton_per_fused_elu_native_layer_norm_1[grid(4)](buf5, buf1,
            primals_5, primals_6, buf2, buf6, 4, 400, num_warps=4, num_stages=1
            )
        del primals_6
        buf7 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        extern_kernels.addmm(primals_8, buf6, reinterpret_tensor(primals_7,
            (400, 300), (1, 400), 0), alpha=1, beta=1, out=buf7)
        del primals_8
        buf8 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf9 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf11 = reinterpret_tensor(buf9, (4, 1), (1, 1), 0)
        del buf9
        buf12 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        triton_per_fused_elu_native_layer_norm_2[grid(4)](buf11, buf7,
            primals_9, primals_10, buf8, buf12, 4, 300, num_warps=4,
            num_stages=1)
        del primals_10
        buf14 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        extern_kernels.addmm(primals_12, buf12, reinterpret_tensor(
            primals_11, (300, 1), (1, 300), 0), alpha=1, beta=1, out=buf14)
        del primals_12
        buf15 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        extern_kernels.addmm(primals_14, buf0, reinterpret_tensor(
            primals_13, (8, 400), (1, 8), 0), alpha=1, beta=1, out=buf15)
        del primals_13
        del primals_14
        buf16 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf17 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf19 = reinterpret_tensor(buf17, (4, 1), (1, 1), 0)
        del buf17
        buf20 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        triton_per_fused_elu_native_layer_norm_1[grid(4)](buf19, buf15,
            primals_15, primals_16, buf16, buf20, 4, 400, num_warps=4,
            num_stages=1)
        del primals_16
        buf21 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        extern_kernels.addmm(primals_18, buf20, reinterpret_tensor(
            primals_17, (400, 300), (1, 400), 0), alpha=1, beta=1, out=buf21)
        del primals_18
        buf22 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf23 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf25 = reinterpret_tensor(buf23, (4, 1), (1, 1), 0)
        del buf23
        buf26 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        triton_per_fused_elu_native_layer_norm_2[grid(4)](buf25, buf21,
            primals_19, primals_20, buf22, buf26, 4, 300, num_warps=4,
            num_stages=1)
        del primals_20
        buf28 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        extern_kernels.addmm(primals_22, buf26, reinterpret_tensor(
            primals_21, (300, 1), (1, 300), 0), alpha=1, beta=1, out=buf28)
        del primals_22
        buf29 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        extern_kernels.addmm(primals_24, primals_1, reinterpret_tensor(
            primals_23, (4, 400), (1, 4), 0), alpha=1, beta=1, out=buf29)
        del primals_23
        del primals_24
        buf30 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf31 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf33 = reinterpret_tensor(buf31, (4, 1), (1, 1), 0)
        del buf31
        buf34 = empty_strided_cuda((4, 400), (400, 1), torch.float32)
        triton_per_fused_elu_native_layer_norm_1[grid(4)](buf33, buf29,
            primals_25, primals_26, buf30, buf34, 4, 400, num_warps=4,
            num_stages=1)
        del primals_26
        buf35 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        extern_kernels.addmm(primals_28, buf34, reinterpret_tensor(
            primals_27, (400, 300), (1, 400), 0), alpha=1, beta=1, out=buf35)
        del primals_28
        buf36 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        buf37 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf39 = reinterpret_tensor(buf37, (4, 1), (1, 1), 0)
        del buf37
        buf40 = empty_strided_cuda((4, 300), (300, 1), torch.float32)
        triton_per_fused_elu_native_layer_norm_2[grid(4)](buf39, buf35,
            primals_29, primals_30, buf36, buf40, 4, 300, num_warps=4,
            num_stages=1)
        del primals_30
        buf42 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        extern_kernels.addmm(primals_32, buf40, reinterpret_tensor(
            primals_31, (300, 1), (1, 300), 0), alpha=1, beta=1, out=buf42)
        del primals_32
    return (buf14, buf28, buf42, primals_1, primals_5, primals_9,
        primals_15, primals_19, primals_25, primals_29, buf0, buf1, buf2,
        buf5, buf6, buf7, buf8, buf11, buf12, buf15, buf16, buf19, buf20,
        buf21, buf22, buf25, buf26, buf29, buf30, buf33, buf34, buf35,
        buf36, buf39, buf40, primals_31, primals_27, primals_21, primals_17,
        primals_11, primals_7)


class CriticNew(nn.Module):
    """Critic model

        Parameters:
              args (object): Parameter class

    """

    def __init__(self, state_dim, action_dim):
        super(CriticNew, self).__init__()
        l1 = 400
        l2 = 300
        self.q1f1 = nn.Linear(state_dim + action_dim, l1)
        self.q1ln1 = nn.LayerNorm(l1)
        self.q1f2 = nn.Linear(l1, l2)
        self.q1ln2 = nn.LayerNorm(l2)
        self.q1out = nn.Linear(l2, 1)
        self.q2f1 = nn.Linear(state_dim + action_dim, l1)
        self.q2ln1 = nn.LayerNorm(l1)
        self.q2f2 = nn.Linear(l1, l2)
        self.q2ln2 = nn.LayerNorm(l2)
        self.q2out = nn.Linear(l2, 1)
        self.vf1 = nn.Linear(state_dim, l1)
        self.vln1 = nn.LayerNorm(l1)
        self.vf2 = nn.Linear(l1, l2)
        self.vln2 = nn.LayerNorm(l2)
        self.vout = nn.Linear(l2, 1)

    def forward(self, input_0, input_1):
        primals_3 = self.q1f1.weight
        primals_4 = self.q1f1.bias
        primals_5 = self.q1ln1.weight
        primals_6 = self.q1ln1.bias
        primals_7 = self.q1f2.weight
        primals_8 = self.q1f2.bias
        primals_9 = self.q1ln2.weight
        primals_10 = self.q1ln2.bias
        primals_11 = self.q1out.weight
        primals_12 = self.q1out.bias
        primals_13 = self.q2f1.weight
        primals_14 = self.q2f1.bias
        primals_15 = self.q2ln1.weight
        primals_16 = self.q2ln1.bias
        primals_17 = self.q2f2.weight
        primals_18 = self.q2f2.bias
        primals_19 = self.q2ln2.weight
        primals_20 = self.q2ln2.bias
        primals_21 = self.q2out.weight
        primals_22 = self.q2out.bias
        primals_23 = self.vf1.weight
        primals_24 = self.vf1.bias
        primals_25 = self.vln1.weight
        primals_26 = self.vln1.bias
        primals_27 = self.vf2.weight
        primals_28 = self.vf2.bias
        primals_29 = self.vln2.weight
        primals_30 = self.vln2.bias
        primals_31 = self.vout.weight
        primals_32 = self.vout.bias
        primals_1 = input_0
        primals_2 = input_1
        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,
            primals_20, primals_21, primals_22, primals_23, primals_24,
            primals_25, primals_26, primals_27, primals_28, primals_29,
            primals_30, primals_31, primals_32])
        return output[0], output[1], output[2]
