# 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_8/inductor_cache/t4/ct4b67pdo2nqkmug5ve6psoz6ptovf44cjwac2selnsbhojvain4.py
# Topologically Sorted Source Nodes: [cat], Original ATen: [aten.cat]
# Source node to ATen node mapping:
#   cat => cat
# Graph fragment:
#   %cat : [num_users=1] = call_function[target=torch.ops.aten.cat.default](args = ([%view, %repeat_1], 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=[128], 
    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_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, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 128
    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*((((4*x1) + x0) // 16) % 4)) + ((((4*x1) + x0) % 16) % 4)), 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_ptr0 + ((4*(x1 % 4)) + ((-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_8/inductor_cache/rs/crsikvivgof4u6qcelh3gov7oade5uaprup6quh2r4qjgsssen7k.py
# Topologically Sorted Source Nodes: [e], Original ATen: [aten.leaky_relu]
# Source node to ATen node mapping:
#   e => gt
# Graph fragment:
#   %gt : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%squeeze, 0), 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=[16], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*i1', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_leaky_relu_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_leaky_relu_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 16
    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 = 0.0
    tmp2 = tmp0 > tmp1
    tl.store(out_ptr0 + (x0), tmp2, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_8/inductor_cache/2k/c2k6idl77paa5lpvj6v4mi3dzsgbzy45voclv5jrtwxnvtfb6k4v.py
# Topologically Sorted Source Nodes: [e, zero_vec, attention, attention_1, e_1, attention_3, attention_4, e_2, attention_6, attention_7, e_3, attention_9, attention_10], Original ATen: [aten.leaky_relu, aten.mul, aten.where, aten._softmax]
# Source node to ATen node mapping:
#   attention => where_1
#   attention_1 => amax, exp, sub, sum_1
#   attention_10 => amax_3, exp_3, sub_3, sum_4
#   attention_3 => where_4
#   attention_4 => amax_1, exp_1, sub_1, sum_2
#   attention_6 => where_7
#   attention_7 => amax_2, exp_2, sub_2, sum_3
#   attention_9 => where_10
#   e => mul, where
#   e_1 => mul_5, where_3
#   e_2 => mul_10, where_6
#   e_3 => mul_15, where_9
#   zero_vec => full_default
# Graph fragment:
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze, 4), kwargs = {})
#   %where : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt, %squeeze, %mul), kwargs = {})
#   %full_default : [num_users=5] = call_function[target=torch.ops.aten.full.default](args = ([4, 4], -8999999815811072.0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %where_1 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where, %full_default), kwargs = {})
#   %amax : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_1, [1], True), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_1, %amax), kwargs = {})
#   %exp : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub,), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp, [1], True), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze_1, 4), kwargs = {})
#   %where_3 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_3, %squeeze_1, %mul_5), kwargs = {})
#   %where_4 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where_3, %full_default), kwargs = {})
#   %amax_1 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_4, [1], True), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_4, %amax_1), kwargs = {})
#   %exp_1 : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_1,), kwargs = {})
#   %sum_2 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp_1, [1], True), kwargs = {})
#   %mul_10 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze_2, 4), kwargs = {})
#   %where_6 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_6, %squeeze_2, %mul_10), kwargs = {})
#   %where_7 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where_6, %full_default), kwargs = {})
#   %amax_2 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_7, [1], True), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_7, %amax_2), kwargs = {})
#   %exp_2 : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_2,), kwargs = {})
#   %sum_3 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp_2, [1], True), kwargs = {})
#   %mul_15 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze_3, 4), kwargs = {})
#   %where_9 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_9, %squeeze_3, %mul_15), kwargs = {})
#   %where_10 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where_9, %full_default), kwargs = {})
#   %amax_3 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_10, [1], True), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_10, %amax_3), kwargs = {})
#   %exp_3 : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_3,), kwargs = {})
#   %sum_4 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp_3, [1], True), kwargs = {})
triton_poi_fused__softmax_leaky_relu_mul_where_2 = async_compile.triton('triton_poi_fused__softmax_leaky_relu_mul_where_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: '*i1', 1: '*i1', 2: '*fp32', 3: '*i1', 4: '*fp32', 5: '*i1', 6: '*fp32', 7: '*i1', 8: '*fp32', 9: '*fp32', 10: '*fp32', 11: '*fp32', 12: '*fp32', 13: '*fp32', 14: '*fp32', 15: '*fp32', 16: '*fp32', 17: '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, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__softmax_leaky_relu_mul_where_2', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 36, '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__softmax_leaky_relu_mul_where_2(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8, out_ptr0, out_ptr1, out_ptr2, out_ptr3, out_ptr4, out_ptr5, out_ptr6, out_ptr7, 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 + (4*x0), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp1 = tl.load(in_ptr1 + (4*x0), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp2 = tl.load(in_ptr2 + (4*x0), xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp9 = tl.load(in_ptr1 + (1 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp10 = tl.load(in_ptr2 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp16 = tl.load(in_ptr1 + (2 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp17 = tl.load(in_ptr2 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp22 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp23 = tl.load(in_ptr1 + (3 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp24 = tl.load(in_ptr2 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp40 = tl.load(in_ptr3 + (4*x0), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp41 = tl.load(in_ptr4 + (4*x0), xmask, eviction_policy='evict_last')
    tmp45 = tl.load(in_ptr3 + (1 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp46 = tl.load(in_ptr4 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp51 = tl.load(in_ptr3 + (2 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp52 = tl.load(in_ptr4 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp57 = tl.load(in_ptr3 + (3 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp58 = tl.load(in_ptr4 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp74 = tl.load(in_ptr5 + (4*x0), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp75 = tl.load(in_ptr6 + (4*x0), xmask, eviction_policy='evict_last')
    tmp79 = tl.load(in_ptr5 + (1 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp80 = tl.load(in_ptr6 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp85 = tl.load(in_ptr5 + (2 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp86 = tl.load(in_ptr6 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp91 = tl.load(in_ptr5 + (3 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp92 = tl.load(in_ptr6 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp108 = tl.load(in_ptr7 + (4*x0), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp109 = tl.load(in_ptr8 + (4*x0), xmask, eviction_policy='evict_last')
    tmp113 = tl.load(in_ptr7 + (1 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp114 = tl.load(in_ptr8 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp119 = tl.load(in_ptr7 + (2 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp120 = tl.load(in_ptr8 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp125 = tl.load(in_ptr7 + (3 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp126 = tl.load(in_ptr8 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp3 = 4.0
    tmp4 = tmp2 * tmp3
    tmp5 = tl.where(tmp1, tmp2, tmp4)
    tmp6 = -8999999815811072.0
    tmp7 = tl.where(tmp0, tmp5, tmp6)
    tmp11 = tmp10 * tmp3
    tmp12 = tl.where(tmp9, tmp10, tmp11)
    tmp13 = tl.where(tmp8, tmp12, tmp6)
    tmp14 = triton_helpers.maximum(tmp7, tmp13)
    tmp18 = tmp17 * tmp3
    tmp19 = tl.where(tmp16, tmp17, tmp18)
    tmp20 = tl.where(tmp15, tmp19, tmp6)
    tmp21 = triton_helpers.maximum(tmp14, tmp20)
    tmp25 = tmp24 * tmp3
    tmp26 = tl.where(tmp23, tmp24, tmp25)
    tmp27 = tl.where(tmp22, tmp26, tmp6)
    tmp28 = triton_helpers.maximum(tmp21, tmp27)
    tmp29 = tmp7 - tmp28
    tmp30 = tl_math.exp(tmp29)
    tmp31 = tmp13 - tmp28
    tmp32 = tl_math.exp(tmp31)
    tmp33 = tmp30 + tmp32
    tmp34 = tmp20 - tmp28
    tmp35 = tl_math.exp(tmp34)
    tmp36 = tmp33 + tmp35
    tmp37 = tmp27 - tmp28
    tmp38 = tl_math.exp(tmp37)
    tmp39 = tmp36 + tmp38
    tmp42 = tmp41 * tmp3
    tmp43 = tl.where(tmp40, tmp41, tmp42)
    tmp44 = tl.where(tmp0, tmp43, tmp6)
    tmp47 = tmp46 * tmp3
    tmp48 = tl.where(tmp45, tmp46, tmp47)
    tmp49 = tl.where(tmp8, tmp48, tmp6)
    tmp50 = triton_helpers.maximum(tmp44, tmp49)
    tmp53 = tmp52 * tmp3
    tmp54 = tl.where(tmp51, tmp52, tmp53)
    tmp55 = tl.where(tmp15, tmp54, tmp6)
    tmp56 = triton_helpers.maximum(tmp50, tmp55)
    tmp59 = tmp58 * tmp3
    tmp60 = tl.where(tmp57, tmp58, tmp59)
    tmp61 = tl.where(tmp22, tmp60, tmp6)
    tmp62 = triton_helpers.maximum(tmp56, tmp61)
    tmp63 = tmp44 - tmp62
    tmp64 = tl_math.exp(tmp63)
    tmp65 = tmp49 - tmp62
    tmp66 = tl_math.exp(tmp65)
    tmp67 = tmp64 + tmp66
    tmp68 = tmp55 - tmp62
    tmp69 = tl_math.exp(tmp68)
    tmp70 = tmp67 + tmp69
    tmp71 = tmp61 - tmp62
    tmp72 = tl_math.exp(tmp71)
    tmp73 = tmp70 + tmp72
    tmp76 = tmp75 * tmp3
    tmp77 = tl.where(tmp74, tmp75, tmp76)
    tmp78 = tl.where(tmp0, tmp77, tmp6)
    tmp81 = tmp80 * tmp3
    tmp82 = tl.where(tmp79, tmp80, tmp81)
    tmp83 = tl.where(tmp8, tmp82, tmp6)
    tmp84 = triton_helpers.maximum(tmp78, tmp83)
    tmp87 = tmp86 * tmp3
    tmp88 = tl.where(tmp85, tmp86, tmp87)
    tmp89 = tl.where(tmp15, tmp88, tmp6)
    tmp90 = triton_helpers.maximum(tmp84, tmp89)
    tmp93 = tmp92 * tmp3
    tmp94 = tl.where(tmp91, tmp92, tmp93)
    tmp95 = tl.where(tmp22, tmp94, tmp6)
    tmp96 = triton_helpers.maximum(tmp90, tmp95)
    tmp97 = tmp78 - tmp96
    tmp98 = tl_math.exp(tmp97)
    tmp99 = tmp83 - tmp96
    tmp100 = tl_math.exp(tmp99)
    tmp101 = tmp98 + tmp100
    tmp102 = tmp89 - tmp96
    tmp103 = tl_math.exp(tmp102)
    tmp104 = tmp101 + tmp103
    tmp105 = tmp95 - tmp96
    tmp106 = tl_math.exp(tmp105)
    tmp107 = tmp104 + tmp106
    tmp110 = tmp109 * tmp3
    tmp111 = tl.where(tmp108, tmp109, tmp110)
    tmp112 = tl.where(tmp0, tmp111, tmp6)
    tmp115 = tmp114 * tmp3
    tmp116 = tl.where(tmp113, tmp114, tmp115)
    tmp117 = tl.where(tmp8, tmp116, tmp6)
    tmp118 = triton_helpers.maximum(tmp112, tmp117)
    tmp121 = tmp120 * tmp3
    tmp122 = tl.where(tmp119, tmp120, tmp121)
    tmp123 = tl.where(tmp15, tmp122, tmp6)
    tmp124 = triton_helpers.maximum(tmp118, tmp123)
    tmp127 = tmp126 * tmp3
    tmp128 = tl.where(tmp125, tmp126, tmp127)
    tmp129 = tl.where(tmp22, tmp128, tmp6)
    tmp130 = triton_helpers.maximum(tmp124, tmp129)
    tmp131 = tmp112 - tmp130
    tmp132 = tl_math.exp(tmp131)
    tmp133 = tmp117 - tmp130
    tmp134 = tl_math.exp(tmp133)
    tmp135 = tmp132 + tmp134
    tmp136 = tmp123 - tmp130
    tmp137 = tl_math.exp(tmp136)
    tmp138 = tmp135 + tmp137
    tmp139 = tmp129 - tmp130
    tmp140 = tl_math.exp(tmp139)
    tmp141 = tmp138 + tmp140
    tl.store(out_ptr0 + (x0), tmp28, xmask)
    tl.store(out_ptr1 + (x0), tmp39, xmask)
    tl.store(out_ptr2 + (x0), tmp62, xmask)
    tl.store(out_ptr3 + (x0), tmp73, xmask)
    tl.store(out_ptr4 + (x0), tmp96, xmask)
    tl.store(out_ptr5 + (x0), tmp107, xmask)
    tl.store(out_ptr6 + (x0), tmp130, xmask)
    tl.store(out_ptr7 + (x0), tmp141, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_8/inductor_cache/hw/chwxxijpaa43oudupbua5ibrakqm6zclctq55ppd6yvy4nqixzjb.py
# Topologically Sorted Source Nodes: [e, zero_vec, attention, attention_1, e_1, attention_3, attention_4, e_2, attention_6, attention_7, e_3, attention_9, attention_10], Original ATen: [aten.leaky_relu, aten.mul, aten.where, aten._softmax]
# Source node to ATen node mapping:
#   attention => where_1
#   attention_1 => div, exp, sub
#   attention_10 => div_3, exp_3, sub_3
#   attention_3 => where_4
#   attention_4 => div_1, exp_1, sub_1
#   attention_6 => where_7
#   attention_7 => div_2, exp_2, sub_2
#   attention_9 => where_10
#   e => mul, where
#   e_1 => mul_5, where_3
#   e_2 => mul_10, where_6
#   e_3 => mul_15, where_9
#   zero_vec => full_default
# Graph fragment:
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze, 4), kwargs = {})
#   %where : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt, %squeeze, %mul), kwargs = {})
#   %full_default : [num_users=5] = call_function[target=torch.ops.aten.full.default](args = ([4, 4], -8999999815811072.0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %where_1 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where, %full_default), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_1, %amax), kwargs = {})
#   %exp : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub,), kwargs = {})
#   %div : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp, %sum_1), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze_1, 4), kwargs = {})
#   %where_3 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_3, %squeeze_1, %mul_5), kwargs = {})
#   %where_4 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where_3, %full_default), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_4, %amax_1), kwargs = {})
#   %exp_1 : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_1,), kwargs = {})
#   %div_1 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp_1, %sum_2), kwargs = {})
#   %mul_10 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze_2, 4), kwargs = {})
#   %where_6 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_6, %squeeze_2, %mul_10), kwargs = {})
#   %where_7 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where_6, %full_default), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_7, %amax_2), kwargs = {})
#   %exp_2 : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_2,), kwargs = {})
#   %div_2 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp_2, %sum_3), kwargs = {})
#   %mul_15 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze_3, 4), kwargs = {})
#   %where_9 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_9, %squeeze_3, %mul_15), kwargs = {})
#   %where_10 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where_9, %full_default), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_10, %amax_3), kwargs = {})
#   %exp_3 : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_3,), kwargs = {})
#   %div_3 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp_3, %sum_4), kwargs = {})
triton_poi_fused__softmax_leaky_relu_mul_where_3 = async_compile.triton('triton_poi_fused__softmax_leaky_relu_mul_where_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=[16], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*i1', 5: '*i1', 6: '*fp32', 7: '*fp32', 8: '*i1', 9: '*fp32', 10: '*fp32', 11: '*i1', 12: '*fp32', 13: '*fp32', 14: '*i1', 15: '*fp32', 16: '*fp32', 17: '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, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__softmax_leaky_relu_mul_where_3', 'mutated_arg_names': ['in_out_ptr0', 'in_out_ptr1', 'in_out_ptr2', 'in_out_ptr3'], 'no_x_dim': False, 'num_load': 17, '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__softmax_leaky_relu_mul_where_3(in_out_ptr0, in_out_ptr1, in_out_ptr2, in_out_ptr3, in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8, in_ptr9, in_ptr10, in_ptr11, in_ptr12, xnumel, XBLOCK : tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x2), xmask).to(tl.int1)
    tmp1 = tl.load(in_ptr1 + (x2), xmask).to(tl.int1)
    tmp2 = tl.load(in_out_ptr0 + (x2), xmask)
    tmp8 = tl.load(in_ptr2 + (x1), xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr3 + (x1), xmask, eviction_policy='evict_last')
    tmp13 = tl.load(in_ptr4 + (x2), xmask).to(tl.int1)
    tmp14 = tl.load(in_out_ptr1 + (x2), xmask)
    tmp18 = tl.load(in_ptr5 + (x1), xmask, eviction_policy='evict_last')
    tmp21 = tl.load(in_ptr6 + (x1), xmask, eviction_policy='evict_last')
    tmp23 = tl.load(in_ptr7 + (x2), xmask).to(tl.int1)
    tmp24 = tl.load(in_out_ptr2 + (x2), xmask)
    tmp28 = tl.load(in_ptr8 + (x1), xmask, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr9 + (x1), xmask, eviction_policy='evict_last')
    tmp33 = tl.load(in_ptr10 + (x2), xmask).to(tl.int1)
    tmp34 = tl.load(in_out_ptr3 + (x2), xmask)
    tmp38 = tl.load(in_ptr11 + (x1), xmask, eviction_policy='evict_last')
    tmp41 = tl.load(in_ptr12 + (x1), xmask, eviction_policy='evict_last')
    tmp3 = 4.0
    tmp4 = tmp2 * tmp3
    tmp5 = tl.where(tmp1, tmp2, tmp4)
    tmp6 = -8999999815811072.0
    tmp7 = tl.where(tmp0, tmp5, tmp6)
    tmp9 = tmp7 - tmp8
    tmp10 = tl_math.exp(tmp9)
    tmp12 = tmp10 / tmp11
    tmp15 = tmp14 * tmp3
    tmp16 = tl.where(tmp13, tmp14, tmp15)
    tmp17 = tl.where(tmp0, tmp16, tmp6)
    tmp19 = tmp17 - tmp18
    tmp20 = tl_math.exp(tmp19)
    tmp22 = tmp20 / tmp21
    tmp25 = tmp24 * tmp3
    tmp26 = tl.where(tmp23, tmp24, tmp25)
    tmp27 = tl.where(tmp0, tmp26, tmp6)
    tmp29 = tmp27 - tmp28
    tmp30 = tl_math.exp(tmp29)
    tmp32 = tmp30 / tmp31
    tmp35 = tmp34 * tmp3
    tmp36 = tl.where(tmp33, tmp34, tmp35)
    tmp37 = tl.where(tmp0, tmp36, tmp6)
    tmp39 = tmp37 - tmp38
    tmp40 = tl_math.exp(tmp39)
    tmp42 = tmp40 / tmp41
    tl.store(in_out_ptr0 + (x2), tmp12, xmask)
    tl.store(in_out_ptr1 + (x2), tmp22, xmask)
    tl.store(in_out_ptr2 + (x2), tmp32, xmask)
    tl.store(in_out_ptr3 + (x2), tmp42, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_8/inductor_cache/6f/c6fg755hkzgmiizoydcu7wlmcvduiztugqjkietqkvpoph4vrtad.py
# Topologically Sorted Source Nodes: [x_1], Original ATen: [aten.cat]
# Source node to ATen node mapping:
#   x_1 => cat_4
# Graph fragment:
#   %cat_4 : [num_users=2] = call_function[target=torch.ops.aten.cat.default](args = ([%where_2, %where_5, %where_8, %where_11], 1), kwargs = {})
triton_poi_fused_cat_4 = async_compile.triton('triton_poi_fused_cat_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=[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_cat_4', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 4, '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_4(in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 16
    x1 = (xindex // 16)
    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 = 0.0
    tmp7 = tmp5 > tmp6
    tmp8 = 1.0
    tmp9 = tmp5 * tmp8
    tmp10 = libdevice.expm1(tmp9)
    tmp11 = tmp10 * tmp8
    tmp12 = tl.where(tmp7, tmp9, tmp11)
    tmp13 = tl.full(tmp12.shape, 0.0, tmp12.dtype)
    tmp14 = tl.where(tmp4, tmp12, tmp13)
    tmp15 = tmp0 >= tmp3
    tmp16 = tl.full([1], 8, tl.int64)
    tmp17 = tmp0 < tmp16
    tmp18 = tmp15 & tmp17
    tmp19 = tl.load(in_ptr1 + ((4*x1) + ((-4) + x0)), tmp18 & xmask, eviction_policy='evict_last', other=0.0)
    tmp20 = tmp19 > tmp6
    tmp21 = tmp19 * tmp8
    tmp22 = libdevice.expm1(tmp21)
    tmp23 = tmp22 * tmp8
    tmp24 = tl.where(tmp20, tmp21, tmp23)
    tmp25 = tl.full(tmp24.shape, 0.0, tmp24.dtype)
    tmp26 = tl.where(tmp18, tmp24, tmp25)
    tmp27 = tmp0 >= tmp16
    tmp28 = tl.full([1], 12, tl.int64)
    tmp29 = tmp0 < tmp28
    tmp30 = tmp27 & tmp29
    tmp31 = tl.load(in_ptr2 + ((4*x1) + ((-8) + x0)), tmp30 & xmask, eviction_policy='evict_last', other=0.0)
    tmp32 = tmp31 > tmp6
    tmp33 = tmp31 * tmp8
    tmp34 = libdevice.expm1(tmp33)
    tmp35 = tmp34 * tmp8
    tmp36 = tl.where(tmp32, tmp33, tmp35)
    tmp37 = tl.full(tmp36.shape, 0.0, tmp36.dtype)
    tmp38 = tl.where(tmp30, tmp36, tmp37)
    tmp39 = tmp0 >= tmp28
    tmp40 = tl.full([1], 16, tl.int64)
    tmp41 = tmp0 < tmp40
    tmp42 = tl.load(in_ptr3 + ((4*x1) + ((-12) + x0)), tmp39 & xmask, eviction_policy='evict_last', other=0.0)
    tmp43 = tmp42 > tmp6
    tmp44 = tmp42 * tmp8
    tmp45 = libdevice.expm1(tmp44)
    tmp46 = tmp45 * tmp8
    tmp47 = tl.where(tmp43, tmp44, tmp46)
    tmp48 = tl.full(tmp47.shape, 0.0, tmp47.dtype)
    tmp49 = tl.where(tmp39, tmp47, tmp48)
    tmp50 = tl.where(tmp30, tmp38, tmp49)
    tmp51 = tl.where(tmp18, tmp26, tmp50)
    tmp52 = tl.where(tmp4, tmp14, tmp51)
    tl.store(out_ptr0 + (x2), tmp52, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_8/inductor_cache/6q/c6qm3bsuqnbgmfnlkkyiezkvruidr5w4kgvxblmhqrkljef5u2ab.py
# Topologically Sorted Source Nodes: [zero_vec, e_4, attention_12, attention_13], Original ATen: [aten.mul, aten.leaky_relu, aten.where, aten._softmax]
# Source node to ATen node mapping:
#   attention_12 => where_13
#   attention_13 => amax_4, exp_4, sub_4, sum_5
#   e_4 => mul_20, where_12
#   zero_vec => full_default
# Graph fragment:
#   %full_default : [num_users=5] = call_function[target=torch.ops.aten.full.default](args = ([4, 4], -8999999815811072.0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %mul_20 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze_4, 4), kwargs = {})
#   %where_12 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_12, %squeeze_4, %mul_20), kwargs = {})
#   %where_13 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where_12, %full_default), kwargs = {})
#   %amax_4 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_13, [1], True), kwargs = {})
#   %sub_4 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_13, %amax_4), kwargs = {})
#   %exp_4 : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_4,), kwargs = {})
#   %sum_5 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp_4, [1], True), kwargs = {})
triton_poi_fused__softmax_leaky_relu_mul_where_5 = async_compile.triton('triton_poi_fused__softmax_leaky_relu_mul_where_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=[4], 
    filename=__file__,
    triton_meta={'signature': {0: '*i1', 1: '*i1', 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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__softmax_leaky_relu_mul_where_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__softmax_leaky_relu_mul_where_5(in_ptr0, in_ptr1, in_ptr2, out_ptr0, out_ptr1, 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 + (4*x0), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp1 = tl.load(in_ptr1 + (4*x0), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp2 = tl.load(in_ptr2 + (4*x0), xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp9 = tl.load(in_ptr1 + (1 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp10 = tl.load(in_ptr2 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp16 = tl.load(in_ptr1 + (2 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp17 = tl.load(in_ptr2 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp22 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp23 = tl.load(in_ptr1 + (3 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp24 = tl.load(in_ptr2 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp3 = 4.0
    tmp4 = tmp2 * tmp3
    tmp5 = tl.where(tmp1, tmp2, tmp4)
    tmp6 = -8999999815811072.0
    tmp7 = tl.where(tmp0, tmp5, tmp6)
    tmp11 = tmp10 * tmp3
    tmp12 = tl.where(tmp9, tmp10, tmp11)
    tmp13 = tl.where(tmp8, tmp12, tmp6)
    tmp14 = triton_helpers.maximum(tmp7, tmp13)
    tmp18 = tmp17 * tmp3
    tmp19 = tl.where(tmp16, tmp17, tmp18)
    tmp20 = tl.where(tmp15, tmp19, tmp6)
    tmp21 = triton_helpers.maximum(tmp14, tmp20)
    tmp25 = tmp24 * tmp3
    tmp26 = tl.where(tmp23, tmp24, tmp25)
    tmp27 = tl.where(tmp22, tmp26, tmp6)
    tmp28 = triton_helpers.maximum(tmp21, tmp27)
    tmp29 = tmp7 - tmp28
    tmp30 = tl_math.exp(tmp29)
    tmp31 = tmp13 - tmp28
    tmp32 = tl_math.exp(tmp31)
    tmp33 = tmp30 + tmp32
    tmp34 = tmp20 - tmp28
    tmp35 = tl_math.exp(tmp34)
    tmp36 = tmp33 + tmp35
    tmp37 = tmp27 - tmp28
    tmp38 = tl_math.exp(tmp37)
    tmp39 = tmp36 + tmp38
    tl.store(out_ptr0 + (x0), tmp28, xmask)
    tl.store(out_ptr1 + (x0), tmp39, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_8/inductor_cache/4f/c4fpasprzjcely6grqxmcycpm24taaowwba6rqvchhupdivgc3gx.py
# Topologically Sorted Source Nodes: [zero_vec, e_4, attention_12, attention_13], Original ATen: [aten.mul, aten.leaky_relu, aten.where, aten._softmax]
# Source node to ATen node mapping:
#   attention_12 => where_13
#   attention_13 => div_4, exp_4, sub_4
#   e_4 => mul_20, where_12
#   zero_vec => full_default
# Graph fragment:
#   %full_default : [num_users=5] = call_function[target=torch.ops.aten.full.default](args = ([4, 4], -8999999815811072.0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %mul_20 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%squeeze_4, 4), kwargs = {})
#   %where_12 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_12, %squeeze_4, %mul_20), kwargs = {})
#   %where_13 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %where_12, %full_default), kwargs = {})
#   %sub_4 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_13, %amax_4), kwargs = {})
#   %exp_4 : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_4,), kwargs = {})
#   %div_4 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp_4, %sum_5), kwargs = {})
triton_poi_fused__softmax_leaky_relu_mul_where_6 = async_compile.triton('triton_poi_fused__softmax_leaky_relu_mul_where_6', '''
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=[16], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*i1', 2: '*i1', 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__softmax_leaky_relu_mul_where_6', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 5, '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__softmax_leaky_relu_mul_where_6(in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, in_ptr3, xnumel, XBLOCK : tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x2), xmask).to(tl.int1)
    tmp1 = tl.load(in_ptr1 + (x2), xmask).to(tl.int1)
    tmp2 = tl.load(in_out_ptr0 + (x2), xmask)
    tmp8 = tl.load(in_ptr2 + (x1), xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr3 + (x1), xmask, eviction_policy='evict_last')
    tmp3 = 4.0
    tmp4 = tmp2 * tmp3
    tmp5 = tl.where(tmp1, tmp2, tmp4)
    tmp6 = -8999999815811072.0
    tmp7 = tl.where(tmp0, tmp5, tmp6)
    tmp9 = tmp7 - tmp8
    tmp10 = tl_math.exp(tmp9)
    tmp12 = tmp10 / tmp11
    tl.store(in_out_ptr0 + (x2), tmp12, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_8/inductor_cache/kh/ckhqmfqvhnwvyhbpb3iprnlwi2pqyf7jm2xk5yxlguo5jfsog2io.py
# Topologically Sorted Source Nodes: [x_3, log_softmax], Original ATen: [aten.elu, aten._log_softmax]
# Source node to ATen node mapping:
#   log_softmax => amax_5, sub_5
#   x_3 => expm1_4, gt_14, mul_22, mul_24, where_14
# Graph fragment:
#   %gt_14 : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%mm_14, 0), kwargs = {})
#   %mul_22 : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mm_14, 1.0), kwargs = {})
#   %expm1_4 : [num_users=1] = call_function[target=torch.ops.aten.expm1.default](args = (%mul_22,), kwargs = {})
#   %mul_24 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%expm1_4, 1.0), kwargs = {})
#   %where_14 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_14, %mul_22, %mul_24), kwargs = {})
#   %amax_5 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_14, [1], True), kwargs = {})
#   %sub_5 : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where_14, %amax_5), kwargs = {})
triton_poi_fused__log_softmax_elu_7 = async_compile.triton('triton_poi_fused__log_softmax_elu_7', '''
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=[16], 
    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__log_softmax_elu_7', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 5, '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__log_softmax_elu_7(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp8 = tl.load(in_ptr0 + (4*x1), xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr0 + (1 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp21 = tl.load(in_ptr0 + (2 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp28 = tl.load(in_ptr0 + (3 + (4*x1)), xmask, eviction_policy='evict_last')
    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)
    tmp9 = tmp8 > tmp1
    tmp10 = tmp8 * tmp3
    tmp11 = libdevice.expm1(tmp10)
    tmp12 = tmp11 * tmp3
    tmp13 = tl.where(tmp9, tmp10, tmp12)
    tmp15 = tmp14 > tmp1
    tmp16 = tmp14 * tmp3
    tmp17 = libdevice.expm1(tmp16)
    tmp18 = tmp17 * tmp3
    tmp19 = tl.where(tmp15, tmp16, tmp18)
    tmp20 = triton_helpers.maximum(tmp13, tmp19)
    tmp22 = tmp21 > tmp1
    tmp23 = tmp21 * tmp3
    tmp24 = libdevice.expm1(tmp23)
    tmp25 = tmp24 * tmp3
    tmp26 = tl.where(tmp22, tmp23, tmp25)
    tmp27 = triton_helpers.maximum(tmp20, tmp26)
    tmp29 = tmp28 > tmp1
    tmp30 = tmp28 * tmp3
    tmp31 = libdevice.expm1(tmp30)
    tmp32 = tmp31 * tmp3
    tmp33 = tl.where(tmp29, tmp30, tmp32)
    tmp34 = triton_helpers.maximum(tmp27, tmp33)
    tmp35 = tmp7 - tmp34
    tl.store(out_ptr0 + (x2), tmp35, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_8/inductor_cache/wb/cwb6yk7fx4digcmhrmo6tjyge2t73fzx437t3vl5lroa6x7t6fem.py
# Topologically Sorted Source Nodes: [log_softmax], Original ATen: [aten._log_softmax]
# Source node to ATen node mapping:
#   log_softmax => exp_5, log, sub_6, sum_6
# Graph fragment:
#   %exp_5 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%sub_5,), kwargs = {})
#   %sum_6 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp_5, [1], True), kwargs = {})
#   %log : [num_users=1] = call_function[target=torch.ops.aten.log.default](args = (%sum_6,), kwargs = {})
#   %sub_6 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sub_5, %log), kwargs = {})
triton_poi_fused__log_softmax_8 = async_compile.triton('triton_poi_fused__log_softmax_8', '''
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=[16], 
    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__log_softmax_8', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 5, '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__log_softmax_8(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr0 + (4*x1), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (1 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (2 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr0 + (3 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp2 = tl_math.exp(tmp1)
    tmp4 = tl_math.exp(tmp3)
    tmp5 = tmp2 + tmp4
    tmp7 = tl_math.exp(tmp6)
    tmp8 = tmp5 + tmp7
    tmp10 = tl_math.exp(tmp9)
    tmp11 = tmp8 + tmp10
    tmp12 = tl_math.log(tmp11)
    tmp13 = tmp0 - tmp12
    tl.store(out_ptr0 + (x2), tmp13, 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 = 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, (8, 1), (1, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    assert_size_stride(primals_5, (4, 4), (4, 1))
    assert_size_stride(primals_6, (8, 1), (1, 1))
    assert_size_stride(primals_7, (4, 4), (4, 1))
    assert_size_stride(primals_8, (8, 1), (1, 1))
    assert_size_stride(primals_9, (4, 4), (4, 1))
    assert_size_stride(primals_10, (8, 1), (1, 1))
    assert_size_stride(primals_11, (16, 4), (4, 1))
    assert_size_stride(primals_12, (8, 1), (1, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h], Original ATen: [aten.mm]
        extern_kernels.mm(primals_1, primals_2, out=buf0)
        del primals_2
        buf1 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        # Topologically Sorted Source Nodes: [cat], Original ATen: [aten.cat]
        stream0 = get_raw_stream(0)
        triton_poi_fused_cat_0.run(buf0, buf1, 128, grid=grid(128), stream=stream0)
        buf2 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul], Original ATen: [aten.mm]
        extern_kernels.mm(buf1, primals_3, out=buf2)
        buf3 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [e], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_1.run(buf2, buf3, 16, grid=grid(16), stream=stream0)
        buf4 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [gt], Original ATen: [aten.gt]
        triton_poi_fused_leaky_relu_1.run(primals_4, buf4, 16, grid=grid(16), stream=stream0)
        del primals_4
        buf9 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_1], Original ATen: [aten.mm]
        extern_kernels.mm(primals_1, primals_5, out=buf9)
        del primals_5
        buf10 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        # Topologically Sorted Source Nodes: [cat_1], Original ATen: [aten.cat]
        triton_poi_fused_cat_0.run(buf9, buf10, 128, grid=grid(128), stream=stream0)
        buf11 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_2], Original ATen: [aten.mm]
        extern_kernels.mm(buf10, primals_6, out=buf11)
        buf12 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [e_1], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_1.run(buf11, buf12, 16, grid=grid(16), stream=stream0)
        buf17 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_2], Original ATen: [aten.mm]
        extern_kernels.mm(primals_1, primals_7, out=buf17)
        del primals_7
        buf18 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        # Topologically Sorted Source Nodes: [cat_2], Original ATen: [aten.cat]
        triton_poi_fused_cat_0.run(buf17, buf18, 128, grid=grid(128), stream=stream0)
        buf19 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_4], Original ATen: [aten.mm]
        extern_kernels.mm(buf18, primals_8, out=buf19)
        buf20 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [e_2], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_1.run(buf19, buf20, 16, grid=grid(16), stream=stream0)
        buf25 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_3], Original ATen: [aten.mm]
        extern_kernels.mm(primals_1, primals_9, out=buf25)
        del primals_9
        buf26 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        # Topologically Sorted Source Nodes: [cat_3], Original ATen: [aten.cat]
        triton_poi_fused_cat_0.run(buf25, buf26, 128, grid=grid(128), stream=stream0)
        buf27 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_6], Original ATen: [aten.mm]
        extern_kernels.mm(buf26, primals_10, out=buf27)
        buf28 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [e_3], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_1.run(buf27, buf28, 16, grid=grid(16), stream=stream0)
        buf5 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf6 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf13 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf14 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf21 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf22 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf29 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf30 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        # Topologically Sorted Source Nodes: [e, zero_vec, attention, attention_1, e_1, attention_3, attention_4, e_2, attention_6, attention_7, e_3, attention_9, attention_10], Original ATen: [aten.leaky_relu, aten.mul, aten.where, aten._softmax]
        triton_poi_fused__softmax_leaky_relu_mul_where_2.run(buf4, buf3, buf2, buf12, buf11, buf20, buf19, buf28, buf27, buf5, buf6, buf13, buf14, buf21, buf22, buf29, buf30, 4, grid=grid(4), stream=stream0)
        buf7 = reinterpret_tensor(buf2, (4, 4), (4, 1), 0); del buf2  # reuse
        buf15 = reinterpret_tensor(buf11, (4, 4), (4, 1), 0); del buf11  # reuse
        buf23 = reinterpret_tensor(buf19, (4, 4), (4, 1), 0); del buf19  # reuse
        buf31 = reinterpret_tensor(buf27, (4, 4), (4, 1), 0); del buf27  # reuse
        # Topologically Sorted Source Nodes: [e, zero_vec, attention, attention_1, e_1, attention_3, attention_4, e_2, attention_6, attention_7, e_3, attention_9, attention_10], Original ATen: [aten.leaky_relu, aten.mul, aten.where, aten._softmax]
        triton_poi_fused__softmax_leaky_relu_mul_where_3.run(buf7, buf15, buf23, buf31, buf4, buf3, buf5, buf6, buf12, buf13, buf14, buf20, buf21, buf22, buf28, buf29, buf30, 16, grid=grid(16), stream=stream0)
        del buf13
        del buf14
        del buf21
        del buf22
        del buf29
        del buf30
        buf8 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_prime], Original ATen: [aten.mm]
        extern_kernels.mm(buf7, buf0, out=buf8)
        buf16 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_prime_1], Original ATen: [aten.mm]
        extern_kernels.mm(buf15, buf9, out=buf16)
        buf24 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_prime_2], Original ATen: [aten.mm]
        extern_kernels.mm(buf23, buf17, out=buf24)
        buf32 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_prime_3], Original ATen: [aten.mm]
        extern_kernels.mm(buf31, buf25, out=buf32)
        buf33 = empty_strided_cuda((4, 16), (16, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_1], Original ATen: [aten.cat]
        triton_poi_fused_cat_4.run(buf8, buf16, buf24, buf32, buf33, 64, grid=grid(64), stream=stream0)
        buf34 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_4], Original ATen: [aten.mm]
        extern_kernels.mm(buf33, primals_11, out=buf34)
        buf35 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        # Topologically Sorted Source Nodes: [cat_5], Original ATen: [aten.cat]
        triton_poi_fused_cat_0.run(buf34, buf35, 128, grid=grid(128), stream=stream0)
        buf36 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_8], Original ATen: [aten.mm]
        extern_kernels.mm(buf35, primals_12, out=buf36)
        buf37 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [e_4], Original ATen: [aten.leaky_relu]
        triton_poi_fused_leaky_relu_1.run(buf36, buf37, 16, grid=grid(16), stream=stream0)
        buf38 = buf6; del buf6  # reuse
        buf39 = buf5; del buf5  # reuse
        # Topologically Sorted Source Nodes: [zero_vec, e_4, attention_12, attention_13], Original ATen: [aten.mul, aten.leaky_relu, aten.where, aten._softmax]
        triton_poi_fused__softmax_leaky_relu_mul_where_5.run(buf4, buf37, buf36, buf38, buf39, 4, grid=grid(4), stream=stream0)
        buf40 = reinterpret_tensor(buf36, (4, 4), (4, 1), 0); del buf36  # reuse
        # Topologically Sorted Source Nodes: [zero_vec, e_4, attention_12, attention_13], Original ATen: [aten.mul, aten.leaky_relu, aten.where, aten._softmax]
        triton_poi_fused__softmax_leaky_relu_mul_where_6.run(buf40, buf4, buf37, buf38, buf39, 16, grid=grid(16), stream=stream0)
        del buf38
        del buf39
        buf41 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_prime_4], Original ATen: [aten.mm]
        extern_kernels.mm(buf40, buf34, out=buf41)
        buf42 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_3, log_softmax], Original ATen: [aten.elu, aten._log_softmax]
        triton_poi_fused__log_softmax_elu_7.run(buf41, buf42, 16, grid=grid(16), stream=stream0)
        buf43 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [log_softmax], Original ATen: [aten._log_softmax]
        triton_poi_fused__log_softmax_8.run(buf42, buf43, 16, grid=grid(16), stream=stream0)
        del buf42
    return (buf43, buf3, buf4, buf7, buf8, buf12, buf15, buf16, buf20, buf23, buf24, buf28, buf31, buf32, buf37, buf40, buf41, buf43, reinterpret_tensor(buf34, (4, 4), (1, 4), 0), reinterpret_tensor(buf35, (8, 16), (1, 8), 0), reinterpret_tensor(primals_12, (1, 8), (1, 1), 0), reinterpret_tensor(buf33, (16, 4), (1, 16), 0), reinterpret_tensor(primals_11, (4, 16), (1, 4), 0), reinterpret_tensor(buf25, (4, 4), (1, 4), 0), reinterpret_tensor(buf26, (8, 16), (1, 8), 0), reinterpret_tensor(primals_10, (1, 8), (1, 1), 0), reinterpret_tensor(primals_1, (4, 4), (1, 4), 0), reinterpret_tensor(buf17, (4, 4), (1, 4), 0), reinterpret_tensor(buf18, (8, 16), (1, 8), 0), reinterpret_tensor(primals_8, (1, 8), (1, 1), 0), reinterpret_tensor(buf9, (4, 4), (1, 4), 0), reinterpret_tensor(buf10, (8, 16), (1, 8), 0), reinterpret_tensor(primals_6, (1, 8), (1, 1), 0), reinterpret_tensor(buf0, (4, 4), (1, 4), 0), reinterpret_tensor(buf1, (8, 16), (1, 8), 0), reinterpret_tensor(primals_3, (1, 8), (1, 1), 0), )


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((8, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((8, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((8, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_10 = rand_strided((8, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_11 = rand_strided((16, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_12 = rand_strided((8, 1), (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])
    return print_performance(fn, times=times, repeat=repeat)


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

import torch
import torch.nn as nn
import torch.nn.functional as F


class GraphAttentionLayer(nn.Module):
    """
    Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
    """

    def __init__(self, in_features, out_features, dropout, alpha, concat=True):
        super(GraphAttentionLayer, self).__init__()
        self.dropout = dropout
        self.in_features = in_features
        self.out_features = out_features
        self.alpha = alpha
        self.concat = concat
        self.W = nn.Parameter(torch.zeros(size=(in_features, out_features)))
        nn.init.xavier_uniform_(self.W.data, gain=1.414)
        self.a = nn.Parameter(torch.zeros(size=(2 * out_features, 1)))
        nn.init.xavier_uniform_(self.a.data, gain=1.414)
        self.leakyrelu = nn.LeakyReLU(self.alpha)

    def forward(self, input, adj):
        h = torch.mm(input, self.W)
        N = h.size()[0]
        a_input = torch.cat([h.repeat(1, N).view(N * N, -1), h.repeat(N, 1)
            ], dim=1).view(N, -1, 2 * self.out_features)
        e = self.leakyrelu(torch.matmul(a_input, self.a).squeeze(2))
        zero_vec = -9000000000000000.0 * torch.ones_like(e)
        attention = torch.where(adj > 0, e, zero_vec)
        attention = F.softmax(attention, dim=1)
        attention = F.dropout(attention, self.dropout, training=self.training)
        h_prime = torch.matmul(attention, h)
        if self.concat:
            return F.elu(h_prime)
        else:
            return h_prime

    def __repr__(self):
        return self.__class__.__name__ + ' (' + str(self.in_features
            ) + ' -> ' + str(self.out_features) + ')'


class GAT(nn.Module):

    def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads):
        """Dense version of GAT."""
        super(GAT, self).__init__()
        self.dropout = dropout
        self.attentions = [GraphAttentionLayer(nfeat, nhid, dropout=dropout,
            alpha=alpha, concat=True) for _ in range(nheads)]
        for i, attention in enumerate(self.attentions):
            self.add_module('attention_{}'.format(i), attention)
        self.out_att = GraphAttentionLayer(nhid * nheads, nclass, dropout=
            dropout, alpha=alpha, concat=False)

    def forward(self, x, adj):
        x = F.dropout(x, self.dropout, training=self.training)
        x = torch.cat([att(x, adj) for att in self.attentions], dim=1)
        x = F.dropout(x, self.dropout, training=self.training)
        x = F.elu(self.out_att(x, adj))
        return F.log_softmax(x, dim=1)


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


def get_init_inputs():
    return [[], {'nfeat': 4, 'nhid': 4, 'nclass': 4, 'dropout': 0.5,
        'alpha': 4, 'nheads': 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, math as tl_math
import torch.nn as nn
import torch.nn.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_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 128
    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 * ((4 * x1 + x0) // 16 % 4) + (4 * x1 + x0) %
        16 % 4), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp6 = tmp0 >= tmp3
    tl.full([1], 8, tl.int64)
    tmp9 = tl.load(in_ptr0 + (4 * (x1 % 4) + (-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_poi_fused_leaky_relu_1(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 16
    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 = 0.0
    tmp2 = tmp0 > tmp1
    tl.store(out_ptr0 + x0, tmp2, xmask)


@triton.jit
def triton_poi_fused__softmax_leaky_relu_mul_where_2(in_ptr0, in_ptr1,
    in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8, out_ptr0,
    out_ptr1, out_ptr2, out_ptr3, out_ptr4, out_ptr5, out_ptr6, out_ptr7,
    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 + 4 * x0, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp1 = tl.load(in_ptr1 + 4 * x0, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp2 = tl.load(in_ptr2 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp9 = tl.load(in_ptr1 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp10 = tl.load(in_ptr2 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp15 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp16 = tl.load(in_ptr1 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp17 = tl.load(in_ptr2 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp22 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp23 = tl.load(in_ptr1 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp24 = tl.load(in_ptr2 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp40 = tl.load(in_ptr3 + 4 * x0, xmask, eviction_policy='evict_last').to(
        tl.int1)
    tmp41 = tl.load(in_ptr4 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp45 = tl.load(in_ptr3 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp46 = tl.load(in_ptr4 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp51 = tl.load(in_ptr3 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp52 = tl.load(in_ptr4 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp57 = tl.load(in_ptr3 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp58 = tl.load(in_ptr4 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp74 = tl.load(in_ptr5 + 4 * x0, xmask, eviction_policy='evict_last').to(
        tl.int1)
    tmp75 = tl.load(in_ptr6 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp79 = tl.load(in_ptr5 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp80 = tl.load(in_ptr6 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp85 = tl.load(in_ptr5 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp86 = tl.load(in_ptr6 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp91 = tl.load(in_ptr5 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp92 = tl.load(in_ptr6 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp108 = tl.load(in_ptr7 + 4 * x0, xmask, eviction_policy='evict_last').to(
        tl.int1)
    tmp109 = tl.load(in_ptr8 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp113 = tl.load(in_ptr7 + (1 + 4 * x0), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp114 = tl.load(in_ptr8 + (1 + 4 * x0), xmask, eviction_policy=
        'evict_last')
    tmp119 = tl.load(in_ptr7 + (2 + 4 * x0), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp120 = tl.load(in_ptr8 + (2 + 4 * x0), xmask, eviction_policy=
        'evict_last')
    tmp125 = tl.load(in_ptr7 + (3 + 4 * x0), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp126 = tl.load(in_ptr8 + (3 + 4 * x0), xmask, eviction_policy=
        'evict_last')
    tmp3 = 4.0
    tmp4 = tmp2 * tmp3
    tmp5 = tl.where(tmp1, tmp2, tmp4)
    tmp6 = -8999999815811072.0
    tmp7 = tl.where(tmp0, tmp5, tmp6)
    tmp11 = tmp10 * tmp3
    tmp12 = tl.where(tmp9, tmp10, tmp11)
    tmp13 = tl.where(tmp8, tmp12, tmp6)
    tmp14 = triton_helpers.maximum(tmp7, tmp13)
    tmp18 = tmp17 * tmp3
    tmp19 = tl.where(tmp16, tmp17, tmp18)
    tmp20 = tl.where(tmp15, tmp19, tmp6)
    tmp21 = triton_helpers.maximum(tmp14, tmp20)
    tmp25 = tmp24 * tmp3
    tmp26 = tl.where(tmp23, tmp24, tmp25)
    tmp27 = tl.where(tmp22, tmp26, tmp6)
    tmp28 = triton_helpers.maximum(tmp21, tmp27)
    tmp29 = tmp7 - tmp28
    tmp30 = tl_math.exp(tmp29)
    tmp31 = tmp13 - tmp28
    tmp32 = tl_math.exp(tmp31)
    tmp33 = tmp30 + tmp32
    tmp34 = tmp20 - tmp28
    tmp35 = tl_math.exp(tmp34)
    tmp36 = tmp33 + tmp35
    tmp37 = tmp27 - tmp28
    tmp38 = tl_math.exp(tmp37)
    tmp39 = tmp36 + tmp38
    tmp42 = tmp41 * tmp3
    tmp43 = tl.where(tmp40, tmp41, tmp42)
    tmp44 = tl.where(tmp0, tmp43, tmp6)
    tmp47 = tmp46 * tmp3
    tmp48 = tl.where(tmp45, tmp46, tmp47)
    tmp49 = tl.where(tmp8, tmp48, tmp6)
    tmp50 = triton_helpers.maximum(tmp44, tmp49)
    tmp53 = tmp52 * tmp3
    tmp54 = tl.where(tmp51, tmp52, tmp53)
    tmp55 = tl.where(tmp15, tmp54, tmp6)
    tmp56 = triton_helpers.maximum(tmp50, tmp55)
    tmp59 = tmp58 * tmp3
    tmp60 = tl.where(tmp57, tmp58, tmp59)
    tmp61 = tl.where(tmp22, tmp60, tmp6)
    tmp62 = triton_helpers.maximum(tmp56, tmp61)
    tmp63 = tmp44 - tmp62
    tmp64 = tl_math.exp(tmp63)
    tmp65 = tmp49 - tmp62
    tmp66 = tl_math.exp(tmp65)
    tmp67 = tmp64 + tmp66
    tmp68 = tmp55 - tmp62
    tmp69 = tl_math.exp(tmp68)
    tmp70 = tmp67 + tmp69
    tmp71 = tmp61 - tmp62
    tmp72 = tl_math.exp(tmp71)
    tmp73 = tmp70 + tmp72
    tmp76 = tmp75 * tmp3
    tmp77 = tl.where(tmp74, tmp75, tmp76)
    tmp78 = tl.where(tmp0, tmp77, tmp6)
    tmp81 = tmp80 * tmp3
    tmp82 = tl.where(tmp79, tmp80, tmp81)
    tmp83 = tl.where(tmp8, tmp82, tmp6)
    tmp84 = triton_helpers.maximum(tmp78, tmp83)
    tmp87 = tmp86 * tmp3
    tmp88 = tl.where(tmp85, tmp86, tmp87)
    tmp89 = tl.where(tmp15, tmp88, tmp6)
    tmp90 = triton_helpers.maximum(tmp84, tmp89)
    tmp93 = tmp92 * tmp3
    tmp94 = tl.where(tmp91, tmp92, tmp93)
    tmp95 = tl.where(tmp22, tmp94, tmp6)
    tmp96 = triton_helpers.maximum(tmp90, tmp95)
    tmp97 = tmp78 - tmp96
    tmp98 = tl_math.exp(tmp97)
    tmp99 = tmp83 - tmp96
    tmp100 = tl_math.exp(tmp99)
    tmp101 = tmp98 + tmp100
    tmp102 = tmp89 - tmp96
    tmp103 = tl_math.exp(tmp102)
    tmp104 = tmp101 + tmp103
    tmp105 = tmp95 - tmp96
    tmp106 = tl_math.exp(tmp105)
    tmp107 = tmp104 + tmp106
    tmp110 = tmp109 * tmp3
    tmp111 = tl.where(tmp108, tmp109, tmp110)
    tmp112 = tl.where(tmp0, tmp111, tmp6)
    tmp115 = tmp114 * tmp3
    tmp116 = tl.where(tmp113, tmp114, tmp115)
    tmp117 = tl.where(tmp8, tmp116, tmp6)
    tmp118 = triton_helpers.maximum(tmp112, tmp117)
    tmp121 = tmp120 * tmp3
    tmp122 = tl.where(tmp119, tmp120, tmp121)
    tmp123 = tl.where(tmp15, tmp122, tmp6)
    tmp124 = triton_helpers.maximum(tmp118, tmp123)
    tmp127 = tmp126 * tmp3
    tmp128 = tl.where(tmp125, tmp126, tmp127)
    tmp129 = tl.where(tmp22, tmp128, tmp6)
    tmp130 = triton_helpers.maximum(tmp124, tmp129)
    tmp131 = tmp112 - tmp130
    tmp132 = tl_math.exp(tmp131)
    tmp133 = tmp117 - tmp130
    tmp134 = tl_math.exp(tmp133)
    tmp135 = tmp132 + tmp134
    tmp136 = tmp123 - tmp130
    tmp137 = tl_math.exp(tmp136)
    tmp138 = tmp135 + tmp137
    tmp139 = tmp129 - tmp130
    tmp140 = tl_math.exp(tmp139)
    tmp141 = tmp138 + tmp140
    tl.store(out_ptr0 + x0, tmp28, xmask)
    tl.store(out_ptr1 + x0, tmp39, xmask)
    tl.store(out_ptr2 + x0, tmp62, xmask)
    tl.store(out_ptr3 + x0, tmp73, xmask)
    tl.store(out_ptr4 + x0, tmp96, xmask)
    tl.store(out_ptr5 + x0, tmp107, xmask)
    tl.store(out_ptr6 + x0, tmp130, xmask)
    tl.store(out_ptr7 + x0, tmp141, xmask)


@triton.jit
def triton_poi_fused__softmax_leaky_relu_mul_where_3(in_out_ptr0,
    in_out_ptr1, in_out_ptr2, in_out_ptr3, in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8, in_ptr9, in_ptr10,
    in_ptr11, in_ptr12, xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask).to(tl.int1)
    tmp1 = tl.load(in_ptr1 + x2, xmask).to(tl.int1)
    tmp2 = tl.load(in_out_ptr0 + x2, xmask)
    tmp8 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr3 + x1, xmask, eviction_policy='evict_last')
    tmp13 = tl.load(in_ptr4 + x2, xmask).to(tl.int1)
    tmp14 = tl.load(in_out_ptr1 + x2, xmask)
    tmp18 = tl.load(in_ptr5 + x1, xmask, eviction_policy='evict_last')
    tmp21 = tl.load(in_ptr6 + x1, xmask, eviction_policy='evict_last')
    tmp23 = tl.load(in_ptr7 + x2, xmask).to(tl.int1)
    tmp24 = tl.load(in_out_ptr2 + x2, xmask)
    tmp28 = tl.load(in_ptr8 + x1, xmask, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr9 + x1, xmask, eviction_policy='evict_last')
    tmp33 = tl.load(in_ptr10 + x2, xmask).to(tl.int1)
    tmp34 = tl.load(in_out_ptr3 + x2, xmask)
    tmp38 = tl.load(in_ptr11 + x1, xmask, eviction_policy='evict_last')
    tmp41 = tl.load(in_ptr12 + x1, xmask, eviction_policy='evict_last')
    tmp3 = 4.0
    tmp4 = tmp2 * tmp3
    tmp5 = tl.where(tmp1, tmp2, tmp4)
    tmp6 = -8999999815811072.0
    tmp7 = tl.where(tmp0, tmp5, tmp6)
    tmp9 = tmp7 - tmp8
    tmp10 = tl_math.exp(tmp9)
    tmp12 = tmp10 / tmp11
    tmp15 = tmp14 * tmp3
    tmp16 = tl.where(tmp13, tmp14, tmp15)
    tmp17 = tl.where(tmp0, tmp16, tmp6)
    tmp19 = tmp17 - tmp18
    tmp20 = tl_math.exp(tmp19)
    tmp22 = tmp20 / tmp21
    tmp25 = tmp24 * tmp3
    tmp26 = tl.where(tmp23, tmp24, tmp25)
    tmp27 = tl.where(tmp0, tmp26, tmp6)
    tmp29 = tmp27 - tmp28
    tmp30 = tl_math.exp(tmp29)
    tmp32 = tmp30 / tmp31
    tmp35 = tmp34 * tmp3
    tmp36 = tl.where(tmp33, tmp34, tmp35)
    tmp37 = tl.where(tmp0, tmp36, tmp6)
    tmp39 = tmp37 - tmp38
    tmp40 = tl_math.exp(tmp39)
    tmp42 = tmp40 / tmp41
    tl.store(in_out_ptr0 + x2, tmp12, xmask)
    tl.store(in_out_ptr1 + x2, tmp22, xmask)
    tl.store(in_out_ptr2 + x2, tmp32, xmask)
    tl.store(in_out_ptr3 + x2, tmp42, xmask)


@triton.jit
def triton_poi_fused_cat_4(in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 16
    x1 = xindex // 16
    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 = 0.0
    tmp7 = tmp5 > tmp6
    tmp8 = 1.0
    tmp9 = tmp5 * tmp8
    tmp10 = libdevice.expm1(tmp9)
    tmp11 = tmp10 * tmp8
    tmp12 = tl.where(tmp7, tmp9, tmp11)
    tmp13 = tl.full(tmp12.shape, 0.0, tmp12.dtype)
    tmp14 = tl.where(tmp4, tmp12, tmp13)
    tmp15 = tmp0 >= tmp3
    tmp16 = tl.full([1], 8, tl.int64)
    tmp17 = tmp0 < tmp16
    tmp18 = tmp15 & tmp17
    tmp19 = tl.load(in_ptr1 + (4 * x1 + (-4 + x0)), tmp18 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp20 = tmp19 > tmp6
    tmp21 = tmp19 * tmp8
    tmp22 = libdevice.expm1(tmp21)
    tmp23 = tmp22 * tmp8
    tmp24 = tl.where(tmp20, tmp21, tmp23)
    tmp25 = tl.full(tmp24.shape, 0.0, tmp24.dtype)
    tmp26 = tl.where(tmp18, tmp24, tmp25)
    tmp27 = tmp0 >= tmp16
    tmp28 = tl.full([1], 12, tl.int64)
    tmp29 = tmp0 < tmp28
    tmp30 = tmp27 & tmp29
    tmp31 = tl.load(in_ptr2 + (4 * x1 + (-8 + x0)), tmp30 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp32 = tmp31 > tmp6
    tmp33 = tmp31 * tmp8
    tmp34 = libdevice.expm1(tmp33)
    tmp35 = tmp34 * tmp8
    tmp36 = tl.where(tmp32, tmp33, tmp35)
    tmp37 = tl.full(tmp36.shape, 0.0, tmp36.dtype)
    tmp38 = tl.where(tmp30, tmp36, tmp37)
    tmp39 = tmp0 >= tmp28
    tl.full([1], 16, tl.int64)
    tmp42 = tl.load(in_ptr3 + (4 * x1 + (-12 + x0)), tmp39 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp43 = tmp42 > tmp6
    tmp44 = tmp42 * tmp8
    tmp45 = libdevice.expm1(tmp44)
    tmp46 = tmp45 * tmp8
    tmp47 = tl.where(tmp43, tmp44, tmp46)
    tmp48 = tl.full(tmp47.shape, 0.0, tmp47.dtype)
    tmp49 = tl.where(tmp39, tmp47, tmp48)
    tmp50 = tl.where(tmp30, tmp38, tmp49)
    tmp51 = tl.where(tmp18, tmp26, tmp50)
    tmp52 = tl.where(tmp4, tmp14, tmp51)
    tl.store(out_ptr0 + x2, tmp52, xmask)


@triton.jit
def triton_poi_fused__softmax_leaky_relu_mul_where_5(in_ptr0, in_ptr1,
    in_ptr2, out_ptr0, out_ptr1, 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 + 4 * x0, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp1 = tl.load(in_ptr1 + 4 * x0, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp2 = tl.load(in_ptr2 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp9 = tl.load(in_ptr1 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp10 = tl.load(in_ptr2 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp15 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp16 = tl.load(in_ptr1 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp17 = tl.load(in_ptr2 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp22 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp23 = tl.load(in_ptr1 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp24 = tl.load(in_ptr2 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp3 = 4.0
    tmp4 = tmp2 * tmp3
    tmp5 = tl.where(tmp1, tmp2, tmp4)
    tmp6 = -8999999815811072.0
    tmp7 = tl.where(tmp0, tmp5, tmp6)
    tmp11 = tmp10 * tmp3
    tmp12 = tl.where(tmp9, tmp10, tmp11)
    tmp13 = tl.where(tmp8, tmp12, tmp6)
    tmp14 = triton_helpers.maximum(tmp7, tmp13)
    tmp18 = tmp17 * tmp3
    tmp19 = tl.where(tmp16, tmp17, tmp18)
    tmp20 = tl.where(tmp15, tmp19, tmp6)
    tmp21 = triton_helpers.maximum(tmp14, tmp20)
    tmp25 = tmp24 * tmp3
    tmp26 = tl.where(tmp23, tmp24, tmp25)
    tmp27 = tl.where(tmp22, tmp26, tmp6)
    tmp28 = triton_helpers.maximum(tmp21, tmp27)
    tmp29 = tmp7 - tmp28
    tmp30 = tl_math.exp(tmp29)
    tmp31 = tmp13 - tmp28
    tmp32 = tl_math.exp(tmp31)
    tmp33 = tmp30 + tmp32
    tmp34 = tmp20 - tmp28
    tmp35 = tl_math.exp(tmp34)
    tmp36 = tmp33 + tmp35
    tmp37 = tmp27 - tmp28
    tmp38 = tl_math.exp(tmp37)
    tmp39 = tmp36 + tmp38
    tl.store(out_ptr0 + x0, tmp28, xmask)
    tl.store(out_ptr1 + x0, tmp39, xmask)


@triton.jit
def triton_poi_fused__softmax_leaky_relu_mul_where_6(in_out_ptr0, in_ptr0,
    in_ptr1, in_ptr2, in_ptr3, xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask).to(tl.int1)
    tmp1 = tl.load(in_ptr1 + x2, xmask).to(tl.int1)
    tmp2 = tl.load(in_out_ptr0 + x2, xmask)
    tmp8 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr3 + x1, xmask, eviction_policy='evict_last')
    tmp3 = 4.0
    tmp4 = tmp2 * tmp3
    tmp5 = tl.where(tmp1, tmp2, tmp4)
    tmp6 = -8999999815811072.0
    tmp7 = tl.where(tmp0, tmp5, tmp6)
    tmp9 = tmp7 - tmp8
    tmp10 = tl_math.exp(tmp9)
    tmp12 = tmp10 / tmp11
    tl.store(in_out_ptr0 + x2, tmp12, xmask)


@triton.jit
def triton_poi_fused__log_softmax_elu_7(in_ptr0, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp8 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp21 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp28 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    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)
    tmp9 = tmp8 > tmp1
    tmp10 = tmp8 * tmp3
    tmp11 = libdevice.expm1(tmp10)
    tmp12 = tmp11 * tmp3
    tmp13 = tl.where(tmp9, tmp10, tmp12)
    tmp15 = tmp14 > tmp1
    tmp16 = tmp14 * tmp3
    tmp17 = libdevice.expm1(tmp16)
    tmp18 = tmp17 * tmp3
    tmp19 = tl.where(tmp15, tmp16, tmp18)
    tmp20 = triton_helpers.maximum(tmp13, tmp19)
    tmp22 = tmp21 > tmp1
    tmp23 = tmp21 * tmp3
    tmp24 = libdevice.expm1(tmp23)
    tmp25 = tmp24 * tmp3
    tmp26 = tl.where(tmp22, tmp23, tmp25)
    tmp27 = triton_helpers.maximum(tmp20, tmp26)
    tmp29 = tmp28 > tmp1
    tmp30 = tmp28 * tmp3
    tmp31 = libdevice.expm1(tmp30)
    tmp32 = tmp31 * tmp3
    tmp33 = tl.where(tmp29, tmp30, tmp32)
    tmp34 = triton_helpers.maximum(tmp27, tmp33)
    tmp35 = tmp7 - tmp34
    tl.store(out_ptr0 + x2, tmp35, xmask)


@triton.jit
def triton_poi_fused__log_softmax_8(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp2 = tl_math.exp(tmp1)
    tmp4 = tl_math.exp(tmp3)
    tmp5 = tmp2 + tmp4
    tmp7 = tl_math.exp(tmp6)
    tmp8 = tmp5 + tmp7
    tmp10 = tl_math.exp(tmp9)
    tmp11 = tmp8 + tmp10
    tmp12 = tl_math.log(tmp11)
    tmp13 = tmp0 - tmp12
    tl.store(out_ptr0 + x2, tmp13, 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
        ) = 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, (8, 1), (1, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    assert_size_stride(primals_5, (4, 4), (4, 1))
    assert_size_stride(primals_6, (8, 1), (1, 1))
    assert_size_stride(primals_7, (4, 4), (4, 1))
    assert_size_stride(primals_8, (8, 1), (1, 1))
    assert_size_stride(primals_9, (4, 4), (4, 1))
    assert_size_stride(primals_10, (8, 1), (1, 1))
    assert_size_stride(primals_11, (16, 4), (4, 1))
    assert_size_stride(primals_12, (8, 1), (1, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(primals_1, primals_2, out=buf0)
        del primals_2
        buf1 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_cat_0[grid(128)](buf0, buf1, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf2 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf1, primals_3, out=buf2)
        buf3 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf2, buf3, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf4 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](primals_4, buf4, 16, XBLOCK
            =16, num_warps=1, num_stages=1)
        del primals_4
        buf9 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(primals_1, primals_5, out=buf9)
        del primals_5
        buf10 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(128)](buf9, buf10, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf11 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf10, primals_6, out=buf11)
        buf12 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf11, buf12, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf17 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(primals_1, primals_7, out=buf17)
        del primals_7
        buf18 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(128)](buf17, buf18, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf19 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf18, primals_8, out=buf19)
        buf20 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf19, buf20, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf25 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(primals_1, primals_9, out=buf25)
        del primals_9
        buf26 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(128)](buf25, buf26, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf27 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf26, primals_10, out=buf27)
        buf28 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf27, buf28, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf5 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf6 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf13 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf14 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf21 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf22 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf29 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf30 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        triton_poi_fused__softmax_leaky_relu_mul_where_2[grid(4)](buf4,
            buf3, buf2, buf12, buf11, buf20, buf19, buf28, buf27, buf5,
            buf6, buf13, buf14, buf21, buf22, buf29, buf30, 4, XBLOCK=4,
            num_warps=1, num_stages=1)
        buf7 = reinterpret_tensor(buf2, (4, 4), (4, 1), 0)
        del buf2
        buf15 = reinterpret_tensor(buf11, (4, 4), (4, 1), 0)
        del buf11
        buf23 = reinterpret_tensor(buf19, (4, 4), (4, 1), 0)
        del buf19
        buf31 = reinterpret_tensor(buf27, (4, 4), (4, 1), 0)
        del buf27
        triton_poi_fused__softmax_leaky_relu_mul_where_3[grid(16)](buf7,
            buf15, buf23, buf31, buf4, buf3, buf5, buf6, buf12, buf13,
            buf14, buf20, buf21, buf22, buf28, buf29, buf30, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        del buf13
        del buf14
        del buf21
        del buf22
        del buf29
        del buf30
        buf8 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf7, buf0, out=buf8)
        buf16 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf15, buf9, out=buf16)
        buf24 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf23, buf17, out=buf24)
        buf32 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf31, buf25, out=buf32)
        buf33 = empty_strided_cuda((4, 16), (16, 1), torch.float32)
        triton_poi_fused_cat_4[grid(64)](buf8, buf16, buf24, buf32, buf33, 
            64, XBLOCK=64, num_warps=1, num_stages=1)
        buf34 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf33, primals_11, out=buf34)
        buf35 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(128)](buf34, buf35, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf36 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf35, primals_12, out=buf36)
        buf37 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf36, buf37, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf38 = buf6
        del buf6
        buf39 = buf5
        del buf5
        triton_poi_fused__softmax_leaky_relu_mul_where_5[grid(4)](buf4,
            buf37, buf36, buf38, buf39, 4, XBLOCK=4, num_warps=1, num_stages=1)
        buf40 = reinterpret_tensor(buf36, (4, 4), (4, 1), 0)
        del buf36
        triton_poi_fused__softmax_leaky_relu_mul_where_6[grid(16)](buf40,
            buf4, buf37, buf38, buf39, 16, XBLOCK=16, num_warps=1, num_stages=1
            )
        del buf38
        del buf39
        buf41 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf40, buf34, out=buf41)
        buf42 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused__log_softmax_elu_7[grid(16)](buf41, buf42, 16,
            XBLOCK=16, num_warps=1, num_stages=1)
        buf43 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused__log_softmax_8[grid(16)](buf42, buf43, 16, XBLOCK=
            16, num_warps=1, num_stages=1)
        del buf42
    return (buf43, buf3, buf4, buf7, buf8, buf12, buf15, buf16, buf20,
        buf23, buf24, buf28, buf31, buf32, buf37, buf40, buf41, buf43,
        reinterpret_tensor(buf34, (4, 4), (1, 4), 0), reinterpret_tensor(
        buf35, (8, 16), (1, 8), 0), reinterpret_tensor(primals_12, (1, 8),
        (1, 1), 0), reinterpret_tensor(buf33, (16, 4), (1, 16), 0),
        reinterpret_tensor(primals_11, (4, 16), (1, 4), 0),
        reinterpret_tensor(buf25, (4, 4), (1, 4), 0), reinterpret_tensor(
        buf26, (8, 16), (1, 8), 0), reinterpret_tensor(primals_10, (1, 8),
        (1, 1), 0), reinterpret_tensor(primals_1, (4, 4), (1, 4), 0),
        reinterpret_tensor(buf17, (4, 4), (1, 4), 0), reinterpret_tensor(
        buf18, (8, 16), (1, 8), 0), reinterpret_tensor(primals_8, (1, 8), (
        1, 1), 0), reinterpret_tensor(buf9, (4, 4), (1, 4), 0),
        reinterpret_tensor(buf10, (8, 16), (1, 8), 0), reinterpret_tensor(
        primals_6, (1, 8), (1, 1), 0), reinterpret_tensor(buf0, (4, 4), (1,
        4), 0), reinterpret_tensor(buf1, (8, 16), (1, 8), 0),
        reinterpret_tensor(primals_3, (1, 8), (1, 1), 0))


class GraphAttentionLayer(nn.Module):
    """
    Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
    """

    def __init__(self, in_features, out_features, dropout, alpha, concat=True):
        super(GraphAttentionLayer, self).__init__()
        self.dropout = dropout
        self.in_features = in_features
        self.out_features = out_features
        self.alpha = alpha
        self.concat = concat
        self.W = nn.Parameter(torch.zeros(size=(in_features, out_features)))
        nn.init.xavier_uniform_(self.W.data, gain=1.414)
        self.a = nn.Parameter(torch.zeros(size=(2 * out_features, 1)))
        nn.init.xavier_uniform_(self.a.data, gain=1.414)
        self.leakyrelu = nn.LeakyReLU(self.alpha)

    def forward(self, input, adj):
        h = torch.mm(input, self.W)
        N = h.size()[0]
        a_input = torch.cat([h.repeat(1, N).view(N * N, -1), h.repeat(N, 1)
            ], dim=1).view(N, -1, 2 * self.out_features)
        e = self.leakyrelu(torch.matmul(a_input, self.a).squeeze(2))
        zero_vec = -9000000000000000.0 * torch.ones_like(e)
        attention = torch.where(adj > 0, e, zero_vec)
        attention = F.softmax(attention, dim=1)
        attention = F.dropout(attention, self.dropout, training=self.training)
        h_prime = torch.matmul(attention, h)
        if self.concat:
            return F.elu(h_prime)
        else:
            return h_prime

    def __repr__(self):
        return self.__class__.__name__ + ' (' + str(self.in_features
            ) + ' -> ' + str(self.out_features) + ')'


class GATNew(nn.Module):

    def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads):
        """Dense version of GAT."""
        super(GATNew, self).__init__()
        self.dropout = dropout
        self.attentions = [GraphAttentionLayer(nfeat, nhid, dropout=dropout,
            alpha=alpha, concat=True) for _ in range(nheads)]
        for i, attention in enumerate(self.attentions):
            self.add_module('attention_{}'.format(i), attention)
        self.out_att = GraphAttentionLayer(nhid * nheads, nclass, dropout=
            dropout, alpha=alpha, concat=False)

    def forward(self, input_0, input_1):
        primals_1 = self.attention_0.W
        primals_3 = self.attention_0.a
        primals_2 = self.attention_1.W
        primals_6 = self.attention_1.a
        primals_4 = self.attention_2.W
        primals_8 = self.attention_2.a
        primals_5 = self.attention_3.W
        primals_10 = self.attention_3.a
        primals_11 = self.out_att.W
        primals_12 = self.out_att.a
        primals_7 = input_0
        primals_9 = 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])
        return output[0]
