# 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/fx/cfxps376igbkryk2lanm5jwyrbfuksiuiuxrcratrmpdcqvdaycx.py
# Topologically Sorted Source Nodes: [sigmoid, h], Original ATen: [aten.sigmoid, aten.mul]
# Source node to ATen node mapping:
#   h => mul
#   sigmoid => sigmoid
# Graph fragment:
#   %sigmoid : [num_users=1] = call_function[target=torch.ops.aten.sigmoid.default](args = (%view_1,), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%view_1, %sigmoid), kwargs = {})
triton_poi_fused_mul_sigmoid_0 = async_compile.triton('triton_poi_fused_mul_sigmoid_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=[4096], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 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_mul_sigmoid_0', 'mutated_arg_names': [], '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_mul_sigmoid_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 4096
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), None)
    tmp1 = tl.sigmoid(tmp0)
    tmp2 = tmp0 * tmp1
    tl.store(out_ptr0 + (x0), tmp2, None)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/ku/ckukyw44hxxcrcpyqqe6auljaf54daimtcs6kbykg5nkqzpxqi7c.py
# Topologically Sorted Source Nodes: [mu], Original ATen: [aten.tanh]
# Source node to ATen node mapping:
#   mu => tanh
# Graph fragment:
#   %tanh : [num_users=2] = call_function[target=torch.ops.aten.tanh.default](args = (%view_5,), kwargs = {})
triton_poi_fused_tanh_1 = async_compile.triton('triton_poi_fused_tanh_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: '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_tanh_1', 'mutated_arg_names': [], '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_tanh_1(in_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_ptr0 + (x0), xmask)
    tmp1 = libdevice.tanh(tmp0)
    tl.store(out_ptr0 + (x0), tmp1, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/fo/cfokpftmldsexreegxi6jmjfkfwgfgugc72bfkdjsgjhcwbxqwag.py
# Topologically Sorted Source Nodes: [v], Original ATen: [aten.softplus]
# Source node to ATen node mapping:
#   v => exp, gt, log1p, where
# Graph fragment:
#   %exp : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%primals_10,), kwargs = {})
#   %log1p : [num_users=1] = call_function[target=torch.ops.aten.log1p.default](args = (%exp,), kwargs = {})
#   %gt : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%primals_10, 20), kwargs = {})
#   %where : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt, %primals_10, %log1p), kwargs = {})
triton_poi_fused_softplus_2 = async_compile.triton('triton_poi_fused_softplus_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=[4], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_softplus_2', 'mutated_arg_names': [], '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_softplus_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 4
    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 = 20.0
    tmp2 = tmp0 > tmp1
    tmp3 = tl_math.exp(tmp0)
    tmp4 = libdevice.log1p(tmp3)
    tmp5 = tl.where(tmp2, tmp0, tmp4)
    tl.store(out_ptr0 + (x0), tmp5, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/7o/c7odor2xtxsyvv6duux4o5xbldvy42fccrtkirxlbr5xr4ofxjwr.py
# Topologically Sorted Source Nodes: [sub], Original ATen: [aten.sub]
# Source node to ATen node mapping:
#   sub => sub
# Graph fragment:
#   %sub : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%normal, %tanh), kwargs = {})
triton_poi_fused_sub_3 = async_compile.triton('triton_poi_fused_sub_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=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 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_sub_3', 'mutated_arg_names': ['in_out_ptr0'], '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_sub_3(in_out_ptr0, in_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_ptr0 + (x0), xmask)
    tmp1 = tl.load(in_out_ptr0 + (x0), xmask)
    tmp2 = tmp0 - tmp1
    tl.store(in_out_ptr0 + (x0), tmp2, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/6k/c6kgopng2xuunijnoz74xntvx5nogelmdave3tib3w36gkhulir3.py
# Topologically Sorted Source Nodes: [var, mul_2], Original ATen: [aten.pow, aten.mul]
# Source node to ATen node mapping:
#   mul_2 => mul_2
#   var => pow_1
# Graph fragment:
#   %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%expand, 2), kwargs = {})
#   %mul_2 : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%pow_1, 2), kwargs = {})
triton_poi_fused_mul_pow_4 = async_compile.triton('triton_poi_fused_mul_pow_4', '''
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: '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_mul_pow_4', 'mutated_arg_names': [], '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_mul_pow_4(in_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 % 4
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last')
    tmp1 = tmp0 * tmp0
    tmp2 = 2.0
    tmp3 = tmp1 * tmp2
    tl.store(out_ptr0 + (x2), tmp3, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/r6/cr6brqnyiqylhmfjnpwhu3ecauqtnligkrymgj4q2q2mxoq43igw.py
# Topologically Sorted Source Nodes: [log_scale, pow_2, neg, truediv, sub_1, log_prob, log_prob_1, add, entropy], Original ATen: [aten.log, aten.pow, aten.neg, aten.div, aten.sub, aten.sum, aten.add]
# Source node to ATen node mapping:
#   add => add
#   entropy => sum_2
#   log_prob => sub_2
#   log_prob_1 => sum_1
#   log_scale => log
#   neg => neg
#   pow_2 => pow_2
#   sub_1 => sub_1
#   truediv => div
# Graph fragment:
#   %log : [num_users=2] = call_function[target=torch.ops.aten.log.default](args = (%expand,), kwargs = {})
#   %pow_2 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub, 2), kwargs = {})
#   %neg : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%pow_2,), kwargs = {})
#   %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%neg, %mul_2), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%div, %log), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sub_1, 0.9189385332046727), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%sub_2, [-1]), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%log, 1.4189385332046727), kwargs = {})
#   %sum_2 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%add, [-1]), kwargs = {})
triton_poi_fused_add_div_log_neg_pow_sub_sum_5 = async_compile.triton('triton_poi_fused_add_div_log_neg_pow_sub_sum_5', '''
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: '*fp32', 5: '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_poi_fused_add_div_log_neg_pow_sub_sum_5', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 12, '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_div_log_neg_pow_sub_sum_5(in_ptr0, in_ptr1, in_ptr2, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (4*x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr1 + (4*x0), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr2 + (0))
    tmp6 = tl.broadcast_to(tmp5, [XBLOCK])
    tmp11 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr1 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr2 + (1))
    tmp17 = tl.broadcast_to(tmp16, [XBLOCK])
    tmp22 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr1 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp27 = tl.load(in_ptr2 + (2))
    tmp28 = tl.broadcast_to(tmp27, [XBLOCK])
    tmp33 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp36 = tl.load(in_ptr1 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp38 = tl.load(in_ptr2 + (3))
    tmp39 = tl.broadcast_to(tmp38, [XBLOCK])
    tmp1 = tmp0 * tmp0
    tmp2 = -tmp1
    tmp4 = tmp2 / tmp3
    tmp7 = tl_math.log(tmp6)
    tmp8 = tmp4 - tmp7
    tmp9 = 0.9189385332046727
    tmp10 = tmp8 - tmp9
    tmp12 = tmp11 * tmp11
    tmp13 = -tmp12
    tmp15 = tmp13 / tmp14
    tmp18 = tl_math.log(tmp17)
    tmp19 = tmp15 - tmp18
    tmp20 = tmp19 - tmp9
    tmp21 = tmp10 + tmp20
    tmp23 = tmp22 * tmp22
    tmp24 = -tmp23
    tmp26 = tmp24 / tmp25
    tmp29 = tl_math.log(tmp28)
    tmp30 = tmp26 - tmp29
    tmp31 = tmp30 - tmp9
    tmp32 = tmp21 + tmp31
    tmp34 = tmp33 * tmp33
    tmp35 = -tmp34
    tmp37 = tmp35 / tmp36
    tmp40 = tl_math.log(tmp39)
    tmp41 = tmp37 - tmp40
    tmp42 = tmp41 - tmp9
    tmp43 = tmp32 + tmp42
    tmp44 = 1.4189385332046727
    tmp45 = tmp7 + tmp44
    tmp46 = tmp18 + tmp44
    tmp47 = tmp45 + tmp46
    tmp48 = tmp29 + tmp44
    tmp49 = tmp47 + tmp48
    tmp50 = tmp40 + tmp44
    tmp51 = tmp49 + tmp50
    tl.store(out_ptr0 + (x0), tmp43, xmask)
    tl.store(out_ptr1 + (x0), tmp51, 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 = args
    args.clear()
    assert_size_stride(primals_1, (64, 4), (4, 1))
    assert_size_stride(primals_2, (64, ), (1, ))
    assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_4, (64, 64), (64, 1))
    assert_size_stride(primals_5, (64, ), (1, ))
    assert_size_stride(primals_6, (4, 64), (64, 1))
    assert_size_stride(primals_7, (4, ), (1, ))
    assert_size_stride(primals_8, (1, 64), (64, 1))
    assert_size_stride(primals_9, (1, ), (1, ))
    assert_size_stride(primals_10, (4, ), (1, ))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((64, 64), (64, 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, 64), (1, 4), 0), alpha=1, beta=1, out=buf0)
        del primals_1
        del primals_2
        buf1 = empty_strided_cuda((4, 4, 4, 64), (1024, 256, 64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [sigmoid, h], Original ATen: [aten.sigmoid, aten.mul]
        stream0 = get_raw_stream(0)
        triton_poi_fused_mul_sigmoid_0.run(buf0, buf1, 4096, grid=grid(4096), stream=stream0)
        buf2 = empty_strided_cuda((64, 64), (64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear_1], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_5, reinterpret_tensor(buf1, (64, 64), (64, 1), 0), reinterpret_tensor(primals_4, (64, 64), (1, 64), 0), alpha=1, beta=1, out=buf2)
        del primals_5
        buf3 = empty_strided_cuda((4, 4, 4, 64), (1024, 256, 64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [sigmoid_1, h_1], Original ATen: [aten.sigmoid, aten.mul]
        triton_poi_fused_mul_sigmoid_0.run(buf2, buf3, 4096, grid=grid(4096), stream=stream0)
        buf4 = 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(buf3, (64, 64), (64, 1), 0), reinterpret_tensor(primals_6, (64, 4), (1, 64), 0), alpha=1, beta=1, out=buf4)
        del primals_7
        buf6 = empty_strided_cuda((64, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [linear_3], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_9, reinterpret_tensor(buf3, (64, 64), (64, 1), 0), reinterpret_tensor(primals_8, (64, 1), (1, 64), 0), alpha=1, beta=1, out=buf6)
        del primals_9
        buf7 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mu], Original ATen: [aten.tanh]
        triton_poi_fused_tanh_1.run(buf4, buf7, 256, grid=grid(256), stream=stream0)
        buf8 = empty_strided_cuda((4, ), (1, ), torch.float32)
        # Topologically Sorted Source Nodes: [v], Original ATen: [aten.softplus]
        triton_poi_fused_softplus_2.run(primals_10, buf8, 4, grid=grid(4), stream=stream0)
        # Topologically Sorted Source Nodes: [mu, actions], Original ATen: [aten.tanh, aten.normal]
        buf9 = torch.ops.aten.normal.Tensor_Tensor(buf7, reinterpret_tensor(buf8, (4, 4, 4, 4), (0, 0, 0, 1), 0))
        buf10 = buf9
        del buf9
        buf11 = buf7; del buf7  # reuse
        # Topologically Sorted Source Nodes: [sub], Original ATen: [aten.sub]
        triton_poi_fused_sub_3.run(buf11, buf10, 256, grid=grid(256), stream=stream0)
        buf12 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [var, mul_2], Original ATen: [aten.pow, aten.mul]
        triton_poi_fused_mul_pow_4.run(buf8, buf12, 256, grid=grid(256), stream=stream0)
        buf13 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf14 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [log_scale, pow_2, neg, truediv, sub_1, log_prob, log_prob_1, add, entropy], Original ATen: [aten.log, aten.pow, aten.neg, aten.div, aten.sub, aten.sum, aten.add]
        triton_poi_fused_add_div_log_neg_pow_sub_sum_5.run(buf11, buf12, buf8, buf13, buf14, 64, grid=grid(64), stream=stream0)
        del buf8
    return (buf10, buf13, buf14, reinterpret_tensor(buf6, (4, 4, 4), (16, 4, 1), 0), primals_10, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), buf0, reinterpret_tensor(buf1, (64, 64), (64, 1), 0), buf2, reinterpret_tensor(buf3, (64, 64), (64, 1), 0), buf4, buf11, buf12, 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((64, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_2 = rand_strided((64, ), (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((64, 64), (64, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((64, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((4, 64), (64, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((1, 64), (64, 1), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((1, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_10 = 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])
    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.functional as F
import torch.nn as nn


def swish(x):
    return x * F.sigmoid(x)


class ActorCritic(nn.Module):
    """Actor (Policy) Model."""

    def __init__(self, state_size, action_size, seed, fc1_units=64,
        fc2_units=64):
        """Initialize parameters and build model.
        Params
        ======
            state_size (int): Dimension of each state
            action_size (int): Dimension of each action
            seed (int): Random seed
        """
        super().__init__()
        self.seed = torch.manual_seed(seed)
        self.fc1 = nn.Linear(state_size, fc1_units)
        self.fc2 = nn.Linear(fc1_units, fc2_units)
        self.actor_fc = nn.Linear(fc2_units, action_size)
        self.critic_fc = nn.Linear(fc2_units, 1)
        self.std = nn.Parameter(torch.zeros(action_size))

    def forward(self, state, actions=None):
        """Build a network that maps state -> actions mu."""
        h = swish(self.fc1(state))
        h = swish(self.fc2(h))
        mu = F.tanh(self.actor_fc(h))
        values = self.critic_fc(h).squeeze(-1)
        dist = torch.distributions.Normal(mu, F.softplus(self.std))
        if actions is None:
            actions = dist.sample()
        log_prob = dist.log_prob(actions)
        log_prob = torch.sum(log_prob, dim=-1)
        entropy = torch.sum(dist.entropy(), dim=-1)
        return actions, log_prob, entropy, values


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


def get_init_inputs():
    return [[], {'state_size': 4, 'action_size': 4, 'seed': 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.triton_helpers import libdevice, math as tl_math
import torch.nn.functional as F
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_poi_fused_mul_sigmoid_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, None)
    tmp1 = tl.sigmoid(tmp0)
    tmp2 = tmp0 * tmp1
    tl.store(out_ptr0 + x0, tmp2, None)


@triton.jit
def triton_poi_fused_tanh_1(in_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_ptr0 + x0, xmask)
    tmp1 = libdevice.tanh(tmp0)
    tl.store(out_ptr0 + x0, tmp1, xmask)


@triton.jit
def triton_poi_fused_softplus_2(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 4
    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 = 20.0
    tmp2 = tmp0 > tmp1
    tmp3 = tl_math.exp(tmp0)
    tmp4 = libdevice.log1p(tmp3)
    tmp5 = tl.where(tmp2, tmp0, tmp4)
    tl.store(out_ptr0 + x0, tmp5, xmask)


@triton.jit
def triton_poi_fused_sub_3(in_out_ptr0, in_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_ptr0 + x0, xmask)
    tmp1 = tl.load(in_out_ptr0 + x0, xmask)
    tmp2 = tmp0 - tmp1
    tl.store(in_out_ptr0 + x0, tmp2, xmask)


@triton.jit
def triton_poi_fused_mul_pow_4(in_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 % 4
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')
    tmp1 = tmp0 * tmp0
    tmp2 = 2.0
    tmp3 = tmp1 * tmp2
    tl.store(out_ptr0 + x2, tmp3, xmask)


@triton.jit
def triton_poi_fused_add_div_log_neg_pow_sub_sum_5(in_ptr0, in_ptr1,
    in_ptr2, out_ptr0, out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr1 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr2 + 0)
    tmp6 = tl.broadcast_to(tmp5, [XBLOCK])
    tmp11 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp14 = tl.load(in_ptr1 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp16 = tl.load(in_ptr2 + 1)
    tmp17 = tl.broadcast_to(tmp16, [XBLOCK])
    tmp22 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp25 = tl.load(in_ptr1 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp27 = tl.load(in_ptr2 + 2)
    tmp28 = tl.broadcast_to(tmp27, [XBLOCK])
    tmp33 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp36 = tl.load(in_ptr1 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp38 = tl.load(in_ptr2 + 3)
    tmp39 = tl.broadcast_to(tmp38, [XBLOCK])
    tmp1 = tmp0 * tmp0
    tmp2 = -tmp1
    tmp4 = tmp2 / tmp3
    tmp7 = tl_math.log(tmp6)
    tmp8 = tmp4 - tmp7
    tmp9 = 0.9189385332046727
    tmp10 = tmp8 - tmp9
    tmp12 = tmp11 * tmp11
    tmp13 = -tmp12
    tmp15 = tmp13 / tmp14
    tmp18 = tl_math.log(tmp17)
    tmp19 = tmp15 - tmp18
    tmp20 = tmp19 - tmp9
    tmp21 = tmp10 + tmp20
    tmp23 = tmp22 * tmp22
    tmp24 = -tmp23
    tmp26 = tmp24 / tmp25
    tmp29 = tl_math.log(tmp28)
    tmp30 = tmp26 - tmp29
    tmp31 = tmp30 - tmp9
    tmp32 = tmp21 + tmp31
    tmp34 = tmp33 * tmp33
    tmp35 = -tmp34
    tmp37 = tmp35 / tmp36
    tmp40 = tl_math.log(tmp39)
    tmp41 = tmp37 - tmp40
    tmp42 = tmp41 - tmp9
    tmp43 = tmp32 + tmp42
    tmp44 = 1.4189385332046727
    tmp45 = tmp7 + tmp44
    tmp46 = tmp18 + tmp44
    tmp47 = tmp45 + tmp46
    tmp48 = tmp29 + tmp44
    tmp49 = tmp47 + tmp48
    tmp50 = tmp40 + tmp44
    tmp51 = tmp49 + tmp50
    tl.store(out_ptr0 + x0, tmp43, xmask)
    tl.store(out_ptr1 + x0, tmp51, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10) = args
    args.clear()
    assert_size_stride(primals_1, (64, 4), (4, 1))
    assert_size_stride(primals_2, (64,), (1,))
    assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_4, (64, 64), (64, 1))
    assert_size_stride(primals_5, (64,), (1,))
    assert_size_stride(primals_6, (4, 64), (64, 1))
    assert_size_stride(primals_7, (4,), (1,))
    assert_size_stride(primals_8, (1, 64), (64, 1))
    assert_size_stride(primals_9, (1,), (1,))
    assert_size_stride(primals_10, (4,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((64, 64), (64, 1), torch.float32)
        extern_kernels.addmm(primals_2, reinterpret_tensor(primals_3, (64, 
            4), (4, 1), 0), reinterpret_tensor(primals_1, (4, 64), (1, 4), 
            0), alpha=1, beta=1, out=buf0)
        del primals_1
        del primals_2
        buf1 = empty_strided_cuda((4, 4, 4, 64), (1024, 256, 64, 1), torch.
            float32)
        get_raw_stream(0)
        triton_poi_fused_mul_sigmoid_0[grid(4096)](buf0, buf1, 4096, XBLOCK
            =128, num_warps=4, num_stages=1)
        buf2 = empty_strided_cuda((64, 64), (64, 1), torch.float32)
        extern_kernels.addmm(primals_5, reinterpret_tensor(buf1, (64, 64),
            (64, 1), 0), reinterpret_tensor(primals_4, (64, 64), (1, 64), 0
            ), alpha=1, beta=1, out=buf2)
        del primals_5
        buf3 = empty_strided_cuda((4, 4, 4, 64), (1024, 256, 64, 1), torch.
            float32)
        triton_poi_fused_mul_sigmoid_0[grid(4096)](buf2, buf3, 4096, XBLOCK
            =128, num_warps=4, num_stages=1)
        buf4 = empty_strided_cuda((64, 4), (4, 1), torch.float32)
        extern_kernels.addmm(primals_7, reinterpret_tensor(buf3, (64, 64),
            (64, 1), 0), reinterpret_tensor(primals_6, (64, 4), (1, 64), 0),
            alpha=1, beta=1, out=buf4)
        del primals_7
        buf6 = empty_strided_cuda((64, 1), (1, 1), torch.float32)
        extern_kernels.addmm(primals_9, reinterpret_tensor(buf3, (64, 64),
            (64, 1), 0), reinterpret_tensor(primals_8, (64, 1), (1, 64), 0),
            alpha=1, beta=1, out=buf6)
        del primals_9
        buf7 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_tanh_1[grid(256)](buf4, buf7, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf8 = empty_strided_cuda((4,), (1,), torch.float32)
        triton_poi_fused_softplus_2[grid(4)](primals_10, buf8, 4, XBLOCK=4,
            num_warps=1, num_stages=1)
        buf9 = torch.ops.aten.normal.Tensor_Tensor(buf7, reinterpret_tensor
            (buf8, (4, 4, 4, 4), (0, 0, 0, 1), 0))
        buf10 = buf9
        del buf9
        buf11 = buf7
        del buf7
        triton_poi_fused_sub_3[grid(256)](buf11, buf10, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf12 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_mul_pow_4[grid(256)](buf8, buf12, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf13 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf14 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        triton_poi_fused_add_div_log_neg_pow_sub_sum_5[grid(64)](buf11,
            buf12, buf8, buf13, buf14, 64, XBLOCK=64, num_warps=1, num_stages=1
            )
        del buf8
    return buf10, buf13, buf14, reinterpret_tensor(buf6, (4, 4, 4), (16, 4,
        1), 0), primals_10, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0
        ), buf0, reinterpret_tensor(buf1, (64, 64), (64, 1), 0
        ), buf2, reinterpret_tensor(buf3, (64, 64), (64, 1), 0
        ), buf4, buf11, buf12, primals_8, primals_6, primals_4


def swish(x):
    return x * F.sigmoid(x)


class ActorCriticNew(nn.Module):
    """Actor (Policy) Model."""

    def __init__(self, state_size, action_size, seed, fc1_units=64,
        fc2_units=64):
        """Initialize parameters and build model.
        Params
        ======
            state_size (int): Dimension of each state
            action_size (int): Dimension of each action
            seed (int): Random seed
        """
        super().__init__()
        self.seed = torch.manual_seed(seed)
        self.fc1 = nn.Linear(state_size, fc1_units)
        self.fc2 = nn.Linear(fc1_units, fc2_units)
        self.actor_fc = nn.Linear(fc2_units, action_size)
        self.critic_fc = nn.Linear(fc2_units, 1)
        self.std = nn.Parameter(torch.zeros(action_size))

    def forward(self, input_0):
        primals_7 = self.std
        primals_1 = self.fc1.weight
        primals_2 = self.fc1.bias
        primals_4 = self.fc2.weight
        primals_5 = self.fc2.bias
        primals_6 = self.actor_fc.weight
        primals_10 = self.actor_fc.bias
        primals_8 = self.critic_fc.weight
        primals_9 = self.critic_fc.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])
        return output[0], output[1], output[2], output[3]
