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

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


# kernel path: runs/run_shard_4/inductor_cache/s4/cs4nfd57ofr376fmxwurzhs4gjpm5ozhhk2tbhok3earnld65s7o.py
# Topologically Sorted Source Nodes: [add, e], Original ATen: [aten.add, aten.leaky_relu]
# Source node to ATen node mapping:
#   add => add
#   e => gt
# Graph fragment:
#   %add : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%expand, %permute_1), kwargs = {})
#   %gt : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%add, 0), kwargs = {})
triton_poi_fused_add_leaky_relu_0 = async_compile.triton('triton_poi_fused_add_leaky_relu_0', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

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

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


# kernel path: runs/run_shard_4/inductor_cache/2o/c2o2llmyrykuiqz2vmequib33h6nytps3whqgce22o2g5scibly5.py
# Topologically Sorted Source Nodes: [eq], Original ATen: [aten.eq]
# Source node to ATen node mapping:
#   eq => eq
# Graph fragment:
#   %eq : [num_users=5] = call_function[target=torch.ops.aten.eq.Scalar](args = (%primals_5, 0), kwargs = {})
triton_poi_fused_eq_1 = async_compile.triton('triton_poi_fused_eq_1', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

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

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*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_eq_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_eq_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), xmask)
    tmp1 = 0.0
    tmp2 = tmp0 == tmp1
    tl.store(out_ptr0 + (x0), tmp2, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/hd/chdzhc5hljexwrhocg3owtjepyf2zihbjkijg6zlrv4aymab5lo6.py
# Topologically Sorted Source Nodes: [add, e, attention, attention_1, add_1, e_1, attention_3, attention_4, add_2, e_2, attention_6, attention_7, add_3, e_3, attention_9, attention_10], Original ATen: [aten.add, aten.leaky_relu, aten.masked_fill, aten._softmax]
# Source node to ATen node mapping:
#   add => add
#   add_1 => add_1
#   add_2 => add_2
#   add_3 => add_3
#   attention => full_default, where_1
#   attention_1 => amax
#   attention_10 => amax_3
#   attention_3 => where_4
#   attention_4 => amax_1
#   attention_6 => where_7
#   attention_7 => amax_2
#   attention_9 => where_10
#   e => mul, where
#   e_1 => mul_4, where_3
#   e_2 => mul_8, where_6
#   e_3 => mul_12, where_9
# Graph fragment:
#   %add : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%expand, %permute_1), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add, 4), kwargs = {})
#   %where : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt, %add, %mul), kwargs = {})
#   %full_default : [num_users=4] = call_function[target=torch.ops.aten.full.default](args = ([], -1000000000.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 = (%eq, %full_default, %where), kwargs = {})
#   %amax : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_1, [2], True), kwargs = {})
#   %add_1 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%expand_4, %permute_3), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_1, 4), kwargs = {})
#   %where_3 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_2, %add_1, %mul_4), kwargs = {})
#   %where_4 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%eq, %full_default, %where_3), kwargs = {})
#   %amax_1 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_4, [2], True), kwargs = {})
#   %add_2 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%expand_8, %permute_5), kwargs = {})
#   %mul_8 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_2, 4), kwargs = {})
#   %where_6 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_4, %add_2, %mul_8), kwargs = {})
#   %where_7 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%eq, %full_default, %where_6), kwargs = {})
#   %amax_2 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_7, [2], True), kwargs = {})
#   %add_3 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%expand_12, %permute_7), kwargs = {})
#   %mul_12 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_3, 4), kwargs = {})
#   %where_9 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_6, %add_3, %mul_12), kwargs = {})
#   %where_10 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%eq, %full_default, %where_9), kwargs = {})
#   %amax_3 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where_10, [2], True), kwargs = {})
triton_poi_fused__softmax_add_leaky_relu_masked_fill_2 = async_compile.triton('triton_poi_fused__softmax_add_leaky_relu_masked_fill_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=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*i1', 1: '*i1', 2: '*fp32', 3: '*fp32', 4: '*i1', 5: '*fp32', 6: '*fp32', 7: '*i1', 8: '*fp32', 9: '*fp32', 10: '*i1', 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, 17), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__softmax_add_leaky_relu_masked_fill_2', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 40, '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_add_leaky_relu_masked_fill_2(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, out_ptr0, out_ptr1, out_ptr2, out_ptr3, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 4
    x3 = (xindex // 4)
    x1 = (xindex // 4) % 4
    x4 = xindex % 16
    x5 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + (16*x3)), xmask).to(tl.int1)
    tmp1 = tl.load(in_ptr1 + (x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp2 = tl.load(in_ptr2 + (4*x1), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr3 + (x4), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr0 + (4 + x0 + (16*x3)), xmask).to(tl.int1)
    tmp11 = tl.load(in_ptr1 + (4 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp12 = tl.load(in_ptr2 + (1 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp18 = tl.load(in_ptr0 + (8 + x0 + (16*x3)), xmask).to(tl.int1)
    tmp19 = tl.load(in_ptr1 + (8 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp20 = tl.load(in_ptr2 + (2 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr0 + (12 + x0 + (16*x3)), xmask).to(tl.int1)
    tmp27 = tl.load(in_ptr1 + (12 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp28 = tl.load(in_ptr2 + (3 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp34 = tl.load(in_ptr4 + (x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp35 = tl.load(in_ptr5 + (4*x1), xmask, eviction_policy='evict_last')
    tmp36 = tl.load(in_ptr6 + (x4), xmask, eviction_policy='evict_last')
    tmp41 = tl.load(in_ptr4 + (4 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp42 = tl.load(in_ptr5 + (1 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp48 = tl.load(in_ptr4 + (8 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp49 = tl.load(in_ptr5 + (2 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp55 = tl.load(in_ptr4 + (12 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp56 = tl.load(in_ptr5 + (3 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp62 = tl.load(in_ptr7 + (x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp63 = tl.load(in_ptr8 + (4*x1), xmask, eviction_policy='evict_last')
    tmp64 = tl.load(in_ptr9 + (x4), xmask, eviction_policy='evict_last')
    tmp69 = tl.load(in_ptr7 + (4 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp70 = tl.load(in_ptr8 + (1 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp76 = tl.load(in_ptr7 + (8 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp77 = tl.load(in_ptr8 + (2 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp83 = tl.load(in_ptr7 + (12 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp84 = tl.load(in_ptr8 + (3 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp90 = tl.load(in_ptr10 + (x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp91 = tl.load(in_ptr11 + (4*x1), xmask, eviction_policy='evict_last')
    tmp92 = tl.load(in_ptr12 + (x4), xmask, eviction_policy='evict_last')
    tmp97 = tl.load(in_ptr10 + (4 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp98 = tl.load(in_ptr11 + (1 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp104 = tl.load(in_ptr10 + (8 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp105 = tl.load(in_ptr11 + (2 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp111 = tl.load(in_ptr10 + (12 + x0 + (16*x1)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp112 = tl.load(in_ptr11 + (3 + (4*x1)), xmask, eviction_policy='evict_last')
    tmp4 = tmp2 + tmp3
    tmp5 = 4.0
    tmp6 = tmp4 * tmp5
    tmp7 = tl.where(tmp1, tmp4, tmp6)
    tmp8 = -1000000000.0
    tmp9 = tl.where(tmp0, tmp8, tmp7)
    tmp13 = tmp12 + tmp3
    tmp14 = tmp13 * tmp5
    tmp15 = tl.where(tmp11, tmp13, tmp14)
    tmp16 = tl.where(tmp10, tmp8, tmp15)
    tmp17 = triton_helpers.maximum(tmp9, tmp16)
    tmp21 = tmp20 + tmp3
    tmp22 = tmp21 * tmp5
    tmp23 = tl.where(tmp19, tmp21, tmp22)
    tmp24 = tl.where(tmp18, tmp8, tmp23)
    tmp25 = triton_helpers.maximum(tmp17, tmp24)
    tmp29 = tmp28 + tmp3
    tmp30 = tmp29 * tmp5
    tmp31 = tl.where(tmp27, tmp29, tmp30)
    tmp32 = tl.where(tmp26, tmp8, tmp31)
    tmp33 = triton_helpers.maximum(tmp25, tmp32)
    tmp37 = tmp35 + tmp36
    tmp38 = tmp37 * tmp5
    tmp39 = tl.where(tmp34, tmp37, tmp38)
    tmp40 = tl.where(tmp0, tmp8, tmp39)
    tmp43 = tmp42 + tmp36
    tmp44 = tmp43 * tmp5
    tmp45 = tl.where(tmp41, tmp43, tmp44)
    tmp46 = tl.where(tmp10, tmp8, tmp45)
    tmp47 = triton_helpers.maximum(tmp40, tmp46)
    tmp50 = tmp49 + tmp36
    tmp51 = tmp50 * tmp5
    tmp52 = tl.where(tmp48, tmp50, tmp51)
    tmp53 = tl.where(tmp18, tmp8, tmp52)
    tmp54 = triton_helpers.maximum(tmp47, tmp53)
    tmp57 = tmp56 + tmp36
    tmp58 = tmp57 * tmp5
    tmp59 = tl.where(tmp55, tmp57, tmp58)
    tmp60 = tl.where(tmp26, tmp8, tmp59)
    tmp61 = triton_helpers.maximum(tmp54, tmp60)
    tmp65 = tmp63 + tmp64
    tmp66 = tmp65 * tmp5
    tmp67 = tl.where(tmp62, tmp65, tmp66)
    tmp68 = tl.where(tmp0, tmp8, tmp67)
    tmp71 = tmp70 + tmp64
    tmp72 = tmp71 * tmp5
    tmp73 = tl.where(tmp69, tmp71, tmp72)
    tmp74 = tl.where(tmp10, tmp8, tmp73)
    tmp75 = triton_helpers.maximum(tmp68, tmp74)
    tmp78 = tmp77 + tmp64
    tmp79 = tmp78 * tmp5
    tmp80 = tl.where(tmp76, tmp78, tmp79)
    tmp81 = tl.where(tmp18, tmp8, tmp80)
    tmp82 = triton_helpers.maximum(tmp75, tmp81)
    tmp85 = tmp84 + tmp64
    tmp86 = tmp85 * tmp5
    tmp87 = tl.where(tmp83, tmp85, tmp86)
    tmp88 = tl.where(tmp26, tmp8, tmp87)
    tmp89 = triton_helpers.maximum(tmp82, tmp88)
    tmp93 = tmp91 + tmp92
    tmp94 = tmp93 * tmp5
    tmp95 = tl.where(tmp90, tmp93, tmp94)
    tmp96 = tl.where(tmp0, tmp8, tmp95)
    tmp99 = tmp98 + tmp92
    tmp100 = tmp99 * tmp5
    tmp101 = tl.where(tmp97, tmp99, tmp100)
    tmp102 = tl.where(tmp10, tmp8, tmp101)
    tmp103 = triton_helpers.maximum(tmp96, tmp102)
    tmp106 = tmp105 + tmp92
    tmp107 = tmp106 * tmp5
    tmp108 = tl.where(tmp104, tmp106, tmp107)
    tmp109 = tl.where(tmp18, tmp8, tmp108)
    tmp110 = triton_helpers.maximum(tmp103, tmp109)
    tmp113 = tmp112 + tmp92
    tmp114 = tmp113 * tmp5
    tmp115 = tl.where(tmp111, tmp113, tmp114)
    tmp116 = tl.where(tmp26, tmp8, tmp115)
    tmp117 = triton_helpers.maximum(tmp110, tmp116)
    tl.store(out_ptr0 + (x5), tmp33, xmask)
    tl.store(out_ptr1 + (x5), tmp61, xmask)
    tl.store(out_ptr2 + (x5), tmp89, xmask)
    tl.store(out_ptr3 + (x5), tmp117, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/pp/cppiisbadsq6kchji7byjmg2gq7dgcxdyrxoe23vj6pgr5lqwamc.py
# Topologically Sorted Source Nodes: [add, e, attention, attention_1, add_1, e_1, attention_3, attention_4, add_2, e_2, attention_6, attention_7, add_3, e_3, attention_9, attention_10], Original ATen: [aten.add, aten.leaky_relu, aten.masked_fill, aten._softmax]
# Source node to ATen node mapping:
#   add => add
#   add_1 => add_1
#   add_2 => add_2
#   add_3 => add_3
#   attention => full_default, where_1
#   attention_1 => exp, sub
#   attention_10 => exp_3, sub_3
#   attention_3 => where_4
#   attention_4 => exp_1, sub_1
#   attention_6 => where_7
#   attention_7 => exp_2, sub_2
#   attention_9 => where_10
#   e => mul, where
#   e_1 => mul_4, where_3
#   e_2 => mul_8, where_6
#   e_3 => mul_12, where_9
# Graph fragment:
#   %add : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%expand, %permute_1), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add, 4), kwargs = {})
#   %where : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt, %add, %mul), kwargs = {})
#   %full_default : [num_users=4] = call_function[target=torch.ops.aten.full.default](args = ([], -1000000000.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 = (%eq, %full_default, %where), 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 = {})
#   %add_1 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%expand_4, %permute_3), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_1, 4), kwargs = {})
#   %where_3 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_2, %add_1, %mul_4), kwargs = {})
#   %where_4 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%eq, %full_default, %where_3), 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 = {})
#   %add_2 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%expand_8, %permute_5), kwargs = {})
#   %mul_8 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_2, 4), kwargs = {})
#   %where_6 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_4, %add_2, %mul_8), kwargs = {})
#   %where_7 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%eq, %full_default, %where_6), 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 = {})
#   %add_3 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%expand_12, %permute_7), kwargs = {})
#   %mul_12 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_3, 4), kwargs = {})
#   %where_9 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_6, %add_3, %mul_12), kwargs = {})
#   %where_10 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%eq, %full_default, %where_9), 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 = {})
triton_poi_fused__softmax_add_leaky_relu_masked_fill_3 = async_compile.triton('triton_poi_fused__softmax_add_leaky_relu_masked_fill_3', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

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

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*i1', 1: '*i1', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*i1', 6: '*fp32', 7: '*fp32', 8: '*fp32', 9: '*i1', 10: '*fp32', 11: '*fp32', 12: '*fp32', 13: '*i1', 14: '*fp32', 15: '*fp32', 16: '*fp32', 17: '*fp32', 18: '*fp32', 19: '*fp32', 20: '*fp32', 21: '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, 18, 19, 20, 21), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__softmax_add_leaky_relu_masked_fill_3', 'mutated_arg_names': [], '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_add_leaky_relu_masked_fill_3(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, in_ptr13, in_ptr14, in_ptr15, in_ptr16, out_ptr0, out_ptr1, out_ptr2, out_ptr3, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x4 = xindex
    x5 = xindex % 64
    x6 = (xindex // 4) % 16
    x0 = xindex % 4
    x2 = (xindex // 16) % 4
    x7 = (xindex // 16)
    tmp0 = tl.load(in_ptr0 + (x4), xmask).to(tl.int1)
    tmp1 = tl.load(in_ptr1 + (x5), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp2 = tl.load(in_ptr2 + (x6), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr3 + (x0 + (4*x2)), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr4 + (x0 + (4*x7)), xmask, eviction_policy='evict_last')
    tmp13 = tl.load(in_ptr5 + (x5), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp14 = tl.load(in_ptr6 + (x6), xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr7 + (x0 + (4*x2)), xmask, eviction_policy='evict_last')
    tmp20 = tl.load(in_ptr8 + (x0 + (4*x7)), xmask, eviction_policy='evict_last')
    tmp23 = tl.load(in_ptr9 + (x5), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp24 = tl.load(in_ptr10 + (x6), xmask, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr11 + (x0 + (4*x2)), xmask, eviction_policy='evict_last')
    tmp30 = tl.load(in_ptr12 + (x0 + (4*x7)), xmask, eviction_policy='evict_last')
    tmp33 = tl.load(in_ptr13 + (x5), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp34 = tl.load(in_ptr14 + (x6), xmask, eviction_policy='evict_last')
    tmp35 = tl.load(in_ptr15 + (x0 + (4*x2)), xmask, eviction_policy='evict_last')
    tmp40 = tl.load(in_ptr16 + (x0 + (4*x7)), xmask, eviction_policy='evict_last')
    tmp4 = tmp2 + tmp3
    tmp5 = 4.0
    tmp6 = tmp4 * tmp5
    tmp7 = tl.where(tmp1, tmp4, tmp6)
    tmp8 = -1000000000.0
    tmp9 = tl.where(tmp0, tmp8, tmp7)
    tmp11 = tmp9 - tmp10
    tmp12 = tl_math.exp(tmp11)
    tmp16 = tmp14 + tmp15
    tmp17 = tmp16 * tmp5
    tmp18 = tl.where(tmp13, tmp16, tmp17)
    tmp19 = tl.where(tmp0, tmp8, tmp18)
    tmp21 = tmp19 - tmp20
    tmp22 = tl_math.exp(tmp21)
    tmp26 = tmp24 + tmp25
    tmp27 = tmp26 * tmp5
    tmp28 = tl.where(tmp23, tmp26, tmp27)
    tmp29 = tl.where(tmp0, tmp8, tmp28)
    tmp31 = tmp29 - tmp30
    tmp32 = tl_math.exp(tmp31)
    tmp36 = tmp34 + tmp35
    tmp37 = tmp36 * tmp5
    tmp38 = tl.where(tmp33, tmp36, tmp37)
    tmp39 = tl.where(tmp0, tmp8, tmp38)
    tmp41 = tmp39 - tmp40
    tmp42 = tl_math.exp(tmp41)
    tl.store(out_ptr0 + (x4), tmp12, xmask)
    tl.store(out_ptr1 + (x4), tmp22, xmask)
    tl.store(out_ptr2 + (x4), tmp32, xmask)
    tl.store(out_ptr3 + (x4), tmp42, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/6j/c6jj3mfuvx32ntzplj576t4i6o33jsiflpl2i57pnuzashe6byow.py
# Topologically Sorted Source Nodes: [attention_1], Original ATen: [aten._softmax]
# Source node to ATen node mapping:
#   attention_1 => div, sum_1
# Graph fragment:
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp, [2], True), kwargs = {})
#   %div : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp, %sum_1), kwargs = {})
triton_poi_fused__softmax_4 = async_compile.triton('triton_poi_fused__softmax_4', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

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

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__softmax_4', '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__softmax_4(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x0 = xindex % 4
    x2 = (xindex // 16)
    tmp0 = tl.load(in_ptr0 + (x3), xmask)
    tmp1 = tl.load(in_ptr0 + (x0 + (16*x2)), xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr0 + (4 + x0 + (16*x2)), xmask, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr0 + (8 + x0 + (16*x2)), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (12 + x0 + (16*x2)), xmask, eviction_policy='evict_last')
    tmp3 = tmp1 + tmp2
    tmp5 = tmp3 + tmp4
    tmp7 = tmp5 + tmp6
    tmp8 = tmp0 / tmp7
    tl.store(out_ptr0 + (x3), tmp8, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/mu/cmu4dmnjb3m2bpsy345zghpbe6uqogqd4h7akjugnavnr5t7dfhe.py
# Topologically Sorted Source Nodes: [h_prime], Original ATen: [aten.clone]
# Source node to ATen node mapping:
#   h_prime => clone_2
# Graph fragment:
#   %clone_2 : [num_users=1] = call_function[target=torch.ops.aten.clone.default](args = (%expand_3,), kwargs = {memory_format: torch.contiguous_format})
triton_poi_fused_clone_5 = async_compile.triton('triton_poi_fused_clone_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=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_clone_5', '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_clone_5(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 64
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last')
    tl.store(out_ptr0 + (x2), tmp0, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/qv/cqvmm4moybtu27oot7ywn4w6woxvsklcp4xiuvjgxcepjmhixern.py
# Topologically Sorted Source Nodes: [x_1], Original ATen: [aten.stack]
# Source node to ATen node mapping:
#   x_1 => cat
# Graph fragment:
#   %cat : [num_users=1] = call_function[target=torch.ops.aten.cat.default](args = ([%where_2, %where_5, %where_8, %where_11], 2), kwargs = {})
triton_poi_fused_stack_6 = async_compile.triton('triton_poi_fused_stack_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=[1024], 
    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_stack_6', '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_stack_6(in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = (xindex // 4) % 16
    x0 = xindex % 4
    x2 = (xindex // 64)
    x3 = xindex
    tmp0 = x1
    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 + (x0 + (4*x1) + (16*x2)), tmp4 & xmask, 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 + (x0 + (4*((-4) + x1)) + (16*x2)), tmp18 & xmask, 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 + (x0 + (4*((-8) + x1)) + (16*x2)), tmp30 & xmask, 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 + (x0 + (4*((-12) + x1)) + (16*x2)), tmp39 & xmask, 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 + (x3), tmp52, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/sp/cspdzqhyb4nsiqlbveqru65u5vxp6yik556mx63rvoyfbjh64xcg.py
# Topologically Sorted Source Nodes: [x_2], Original ATen: [aten.sum]
# Source node to ATen node mapping:
#   x_2 => sum_5
# Graph fragment:
#   %sum_5 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%view_36, [2]), kwargs = {})
triton_poi_fused_sum_7 = async_compile.triton('triton_poi_fused_sum_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=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_sum_7', '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_sum_7(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 16
    x1 = (xindex // 16)
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + (64*x1)), xmask)
    tmp1 = tl.load(in_ptr0 + (16 + x0 + (64*x1)), xmask)
    tmp3 = tl.load(in_ptr0 + (32 + x0 + (64*x1)), xmask)
    tmp5 = tl.load(in_ptr0 + (48 + x0 + (64*x1)), xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tl.store(out_ptr0 + (x2), tmp6, xmask)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

def call(args):
    primals_1, primals_2, primals_3, primals_4, primals_5, primals_6, primals_7, primals_8, primals_9, primals_10, primals_11, primals_12, primals_13, primals_14 = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_2, (4, 4), (4, 1))
    assert_size_stride(primals_3, (4, 1), (1, 1))
    assert_size_stride(primals_4, (4, 1), (1, 1))
    assert_size_stride(primals_5, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_6, (4, 4), (4, 1))
    assert_size_stride(primals_7, (4, 1), (1, 1))
    assert_size_stride(primals_8, (4, 1), (1, 1))
    assert_size_stride(primals_9, (4, 4), (4, 1))
    assert_size_stride(primals_10, (4, 1), (1, 1))
    assert_size_stride(primals_11, (4, 1), (1, 1))
    assert_size_stride(primals_12, (4, 4), (4, 1))
    assert_size_stride(primals_13, (4, 1), (1, 1))
    assert_size_stride(primals_14, (4, 1), (1, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h], Original ATen: [aten.mm]
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0), reinterpret_tensor(primals_2, (4, 4), (1, 4), 0), out=buf0)
        del primals_2
        buf1 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul], Original ATen: [aten.mm]
        extern_kernels.mm(buf0, primals_3, out=buf1)
        buf2 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_1], Original ATen: [aten.mm]
        extern_kernels.mm(buf0, primals_4, out=buf2)
        buf3 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [add, e], Original ATen: [aten.add, aten.leaky_relu]
        stream0 = get_raw_stream(0)
        triton_poi_fused_add_leaky_relu_0.run(buf1, buf2, buf3, 64, grid=grid(64), stream=stream0)
        buf4 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [eq], Original ATen: [aten.eq]
        triton_poi_fused_eq_1.run(primals_5, buf4, 256, grid=grid(256), stream=stream0)
        del primals_5
        buf10 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_1], Original ATen: [aten.mm]
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0), reinterpret_tensor(primals_6, (4, 4), (1, 4), 0), out=buf10)
        del primals_6
        buf11 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_3], Original ATen: [aten.mm]
        extern_kernels.mm(buf10, primals_7, out=buf11)
        buf12 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_4], Original ATen: [aten.mm]
        extern_kernels.mm(buf10, primals_8, out=buf12)
        buf13 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [add_1, e_1], Original ATen: [aten.add, aten.leaky_relu]
        triton_poi_fused_add_leaky_relu_0.run(buf11, buf12, buf13, 64, grid=grid(64), stream=stream0)
        buf19 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_2], Original ATen: [aten.mm]
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0), reinterpret_tensor(primals_9, (4, 4), (1, 4), 0), out=buf19)
        del primals_9
        buf20 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_6], Original ATen: [aten.mm]
        extern_kernels.mm(buf19, primals_10, out=buf20)
        buf21 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_7], Original ATen: [aten.mm]
        extern_kernels.mm(buf19, primals_11, out=buf21)
        buf22 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [add_2, e_2], Original ATen: [aten.add, aten.leaky_relu]
        triton_poi_fused_add_leaky_relu_0.run(buf20, buf21, buf22, 64, grid=grid(64), stream=stream0)
        buf28 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_3], Original ATen: [aten.mm]
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0), reinterpret_tensor(primals_12, (4, 4), (1, 4), 0), out=buf28)
        del primals_12
        buf29 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_9], Original ATen: [aten.mm]
        extern_kernels.mm(buf28, primals_13, out=buf29)
        buf30 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul_10], Original ATen: [aten.mm]
        extern_kernels.mm(buf28, primals_14, out=buf30)
        buf31 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [add_3, e_3], Original ATen: [aten.add, aten.leaky_relu]
        triton_poi_fused_add_leaky_relu_0.run(buf29, buf30, buf31, 64, grid=grid(64), stream=stream0)
        buf5 = empty_strided_cuda((4, 4, 1, 4), (16, 4, 64, 1), torch.float32)
        buf14 = empty_strided_cuda((4, 4, 1, 4), (16, 4, 64, 1), torch.float32)
        buf23 = empty_strided_cuda((4, 4, 1, 4), (16, 4, 64, 1), torch.float32)
        buf32 = empty_strided_cuda((4, 4, 1, 4), (16, 4, 64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [add, e, attention, attention_1, add_1, e_1, attention_3, attention_4, add_2, e_2, attention_6, attention_7, add_3, e_3, attention_9, attention_10], Original ATen: [aten.add, aten.leaky_relu, aten.masked_fill, aten._softmax]
        triton_poi_fused__softmax_add_leaky_relu_masked_fill_2.run(buf4, buf3, buf1, buf2, buf13, buf11, buf12, buf22, buf20, buf21, buf31, buf29, buf30, buf5, buf14, buf23, buf32, 64, grid=grid(64), stream=stream0)
        buf6 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf15 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf24 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf33 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [add, e, attention, attention_1, add_1, e_1, attention_3, attention_4, add_2, e_2, attention_6, attention_7, add_3, e_3, attention_9, attention_10], Original ATen: [aten.add, aten.leaky_relu, aten.masked_fill, aten._softmax]
        triton_poi_fused__softmax_add_leaky_relu_masked_fill_3.run(buf4, buf3, buf1, buf2, buf5, buf13, buf11, buf12, buf14, buf22, buf20, buf21, buf23, buf31, buf29, buf30, buf32, buf6, buf15, buf24, buf33, 256, grid=grid(256), stream=stream0)
        del buf1
        del buf11
        del buf12
        del buf14
        del buf2
        del buf20
        del buf21
        del buf23
        del buf29
        del buf30
        del buf32
        del buf5
        buf7 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [attention_1], Original ATen: [aten._softmax]
        triton_poi_fused__softmax_4.run(buf6, buf7, 256, grid=grid(256), stream=stream0)
        buf8 = buf6; del buf6  # reuse
        # Topologically Sorted Source Nodes: [h_prime], Original ATen: [aten.clone]
        triton_poi_fused_clone_5.run(buf0, buf8, 256, grid=grid(256), stream=stream0)
        buf9 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_prime], Original ATen: [aten.bmm]
        extern_kernels.bmm(reinterpret_tensor(buf7, (16, 4, 4), (16, 4, 1), 0), reinterpret_tensor(buf8, (16, 4, 4), (16, 4, 1), 0), out=buf9)
        buf16 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [attention_4], Original ATen: [aten._softmax]
        triton_poi_fused__softmax_4.run(buf15, buf16, 256, grid=grid(256), stream=stream0)
        buf17 = buf15; del buf15  # reuse
        # Topologically Sorted Source Nodes: [h_prime_1], Original ATen: [aten.clone]
        triton_poi_fused_clone_5.run(buf10, buf17, 256, grid=grid(256), stream=stream0)
        buf18 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_prime_1], Original ATen: [aten.bmm]
        extern_kernels.bmm(reinterpret_tensor(buf16, (16, 4, 4), (16, 4, 1), 0), reinterpret_tensor(buf17, (16, 4, 4), (16, 4, 1), 0), out=buf18)
        buf25 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [attention_7], Original ATen: [aten._softmax]
        triton_poi_fused__softmax_4.run(buf24, buf25, 256, grid=grid(256), stream=stream0)
        buf26 = buf24; del buf24  # reuse
        # Topologically Sorted Source Nodes: [h_prime_2], Original ATen: [aten.clone]
        triton_poi_fused_clone_5.run(buf19, buf26, 256, grid=grid(256), stream=stream0)
        buf27 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_prime_2], Original ATen: [aten.bmm]
        extern_kernels.bmm(reinterpret_tensor(buf25, (16, 4, 4), (16, 4, 1), 0), reinterpret_tensor(buf26, (16, 4, 4), (16, 4, 1), 0), out=buf27)
        buf34 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [attention_10], Original ATen: [aten._softmax]
        triton_poi_fused__softmax_4.run(buf33, buf34, 256, grid=grid(256), stream=stream0)
        buf35 = buf33; del buf33  # reuse
        # Topologically Sorted Source Nodes: [h_prime_3], Original ATen: [aten.clone]
        triton_poi_fused_clone_5.run(buf28, buf35, 256, grid=grid(256), stream=stream0)
        buf36 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_prime_3], Original ATen: [aten.bmm]
        extern_kernels.bmm(reinterpret_tensor(buf34, (16, 4, 4), (16, 4, 1), 0), reinterpret_tensor(buf35, (16, 4, 4), (16, 4, 1), 0), out=buf36)
        buf37 = empty_strided_cuda((4, 4, 16, 4), (256, 64, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_1], Original ATen: [aten.stack]
        triton_poi_fused_stack_6.run(buf9, buf18, buf27, buf36, buf37, 1024, grid=grid(1024), stream=stream0)
        buf38 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_2], Original ATen: [aten.sum]
        triton_poi_fused_sum_7.run(buf37, buf38, 256, grid=grid(256), stream=stream0)
        del buf37
    return (buf38, reinterpret_tensor(primals_1, (16, 4), (4, 1), 0), buf3, buf4, buf7, buf9, buf13, buf16, buf18, buf22, buf25, buf27, buf31, buf34, buf36, reinterpret_tensor(buf35, (16, 4, 4), (16, 1, 4), 0), reinterpret_tensor(buf28, (4, 16), (1, 4), 0), reinterpret_tensor(primals_14, (1, 4), (1, 1), 0), reinterpret_tensor(primals_13, (1, 4), (1, 1), 0), reinterpret_tensor(buf26, (16, 4, 4), (16, 1, 4), 0), reinterpret_tensor(buf19, (4, 16), (1, 4), 0), reinterpret_tensor(primals_11, (1, 4), (1, 1), 0), reinterpret_tensor(primals_10, (1, 4), (1, 1), 0), reinterpret_tensor(buf17, (16, 4, 4), (16, 1, 4), 0), reinterpret_tensor(buf10, (4, 16), (1, 4), 0), reinterpret_tensor(primals_8, (1, 4), (1, 1), 0), reinterpret_tensor(primals_7, (1, 4), (1, 1), 0), reinterpret_tensor(buf8, (16, 4, 4), (16, 1, 4), 0), reinterpret_tensor(buf0, (4, 16), (1, 4), 0), reinterpret_tensor(primals_4, (1, 4), (1, 1), 0), reinterpret_tensor(primals_3, (1, 4), (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), (16, 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((4, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((4, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((4, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((4, 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((4, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_11 = rand_strided((4, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_12 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_13 = rand_strided((4, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_14 = rand_strided((4, 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, primals_13, primals_14])
    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):

    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.Linear(in_features, out_features, bias=False)
        nn.init.xavier_uniform_(self.W.weight, gain=1.414)
        self.a1 = nn.Parameter(torch.zeros(size=(out_features, 1)))
        self.a2 = nn.Parameter(torch.zeros(size=(out_features, 1)))
        nn.init.xavier_uniform_(self.a1.data, gain=1.414)
        nn.init.xavier_uniform_(self.a2.data, gain=1.414)
        self.leakyrelu = nn.LeakyReLU(self.alpha)

    def forward(self, input, adj):
        h = self.W(input)
        _batch_size, N, _ = h.size()
        middle_result1 = torch.matmul(h, self.a1).expand(-1, -1, N)
        middle_result2 = torch.matmul(h, self.a2).expand(-1, -1, N).transpose(
            1, 2)
        e = self.leakyrelu(middle_result1 + middle_result2)
        attention = e.masked_fill(adj == 0, -1000000000.0)
        attention = F.softmax(attention, dim=2)
        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, out_dim, dropout, alpha, nheads, layer):
        super(GAT, self).__init__()
        self.dropout = dropout
        self.layer = layer
        if self.layer == 1:
            self.attentions = [GraphAttentionLayer(nfeat, out_dim, dropout=
                dropout, alpha=alpha, concat=True) for _ in range(nheads)]
        else:
            self.attentions = [GraphAttentionLayer(nfeat, nhid, dropout=
                dropout, alpha=alpha, concat=True) for _ in range(nheads)]
            self.out_att = GraphAttentionLayer(nhid * nheads, out_dim,
                dropout=dropout, alpha=alpha, concat=False)
        for i, attention in enumerate(self.attentions):
            self.add_module('attention_{}'.format(i), attention)

    def forward(self, x, adj):
        x = F.dropout(x, self.dropout, training=self.training)
        if self.layer == 1:
            x = torch.stack([att(x, adj) for att in self.attentions], dim=2)
            x = x.sum(2)
        else:
            x = torch.cat([att(x, adj) for att in self.attentions], dim=2)
        return x


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


def get_init_inputs():
    return [[], {'nfeat': 4, 'nhid': 4, 'out_dim': 4, 'dropout': 0.5,
        'alpha': 4, 'nheads': 4, 'layer': 1}]

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_add_leaky_relu_0(in_ptr0, in_ptr1, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex // 4
    x0 = xindex % 4
    x2 = xindex // 16
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + x3, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + (x0 + 4 * x2), xmask, eviction_policy='evict_last'
        )
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tl.store(out_ptr0 + x4, tmp4, xmask)


@triton.jit
def triton_poi_fused_eq_1(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask)
    tmp1 = 0.0
    tmp2 = tmp0 == tmp1
    tl.store(out_ptr0 + x0, tmp2, xmask)


@triton.jit
def triton_poi_fused__softmax_add_leaky_relu_masked_fill_2(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, out_ptr0, out_ptr1, out_ptr2, out_ptr3,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 4
    x3 = xindex // 4
    x1 = xindex // 4 % 4
    x4 = xindex % 16
    x5 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 16 * x3), xmask).to(tl.int1)
    tmp1 = tl.load(in_ptr1 + (x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp2 = tl.load(in_ptr2 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr3 + x4, xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr0 + (4 + x0 + 16 * x3), xmask).to(tl.int1)
    tmp11 = tl.load(in_ptr1 + (4 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp12 = tl.load(in_ptr2 + (1 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp18 = tl.load(in_ptr0 + (8 + x0 + 16 * x3), xmask).to(tl.int1)
    tmp19 = tl.load(in_ptr1 + (8 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp20 = tl.load(in_ptr2 + (2 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp26 = tl.load(in_ptr0 + (12 + x0 + 16 * x3), xmask).to(tl.int1)
    tmp27 = tl.load(in_ptr1 + (12 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp28 = tl.load(in_ptr2 + (3 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp34 = tl.load(in_ptr4 + (x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp35 = tl.load(in_ptr5 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp36 = tl.load(in_ptr6 + x4, xmask, eviction_policy='evict_last')
    tmp41 = tl.load(in_ptr4 + (4 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp42 = tl.load(in_ptr5 + (1 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp48 = tl.load(in_ptr4 + (8 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp49 = tl.load(in_ptr5 + (2 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp55 = tl.load(in_ptr4 + (12 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp56 = tl.load(in_ptr5 + (3 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp62 = tl.load(in_ptr7 + (x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp63 = tl.load(in_ptr8 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp64 = tl.load(in_ptr9 + x4, xmask, eviction_policy='evict_last')
    tmp69 = tl.load(in_ptr7 + (4 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp70 = tl.load(in_ptr8 + (1 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp76 = tl.load(in_ptr7 + (8 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp77 = tl.load(in_ptr8 + (2 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp83 = tl.load(in_ptr7 + (12 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp84 = tl.load(in_ptr8 + (3 + 4 * x1), xmask, eviction_policy='evict_last'
        )
    tmp90 = tl.load(in_ptr10 + (x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp91 = tl.load(in_ptr11 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp92 = tl.load(in_ptr12 + x4, xmask, eviction_policy='evict_last')
    tmp97 = tl.load(in_ptr10 + (4 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp98 = tl.load(in_ptr11 + (1 + 4 * x1), xmask, eviction_policy=
        'evict_last')
    tmp104 = tl.load(in_ptr10 + (8 + x0 + 16 * x1), xmask, eviction_policy=
        'evict_last').to(tl.int1)
    tmp105 = tl.load(in_ptr11 + (2 + 4 * x1), xmask, eviction_policy=
        'evict_last')
    tmp111 = tl.load(in_ptr10 + (12 + x0 + 16 * x1), xmask, eviction_policy
        ='evict_last').to(tl.int1)
    tmp112 = tl.load(in_ptr11 + (3 + 4 * x1), xmask, eviction_policy=
        'evict_last')
    tmp4 = tmp2 + tmp3
    tmp5 = 4.0
    tmp6 = tmp4 * tmp5
    tmp7 = tl.where(tmp1, tmp4, tmp6)
    tmp8 = -1000000000.0
    tmp9 = tl.where(tmp0, tmp8, tmp7)
    tmp13 = tmp12 + tmp3
    tmp14 = tmp13 * tmp5
    tmp15 = tl.where(tmp11, tmp13, tmp14)
    tmp16 = tl.where(tmp10, tmp8, tmp15)
    tmp17 = triton_helpers.maximum(tmp9, tmp16)
    tmp21 = tmp20 + tmp3
    tmp22 = tmp21 * tmp5
    tmp23 = tl.where(tmp19, tmp21, tmp22)
    tmp24 = tl.where(tmp18, tmp8, tmp23)
    tmp25 = triton_helpers.maximum(tmp17, tmp24)
    tmp29 = tmp28 + tmp3
    tmp30 = tmp29 * tmp5
    tmp31 = tl.where(tmp27, tmp29, tmp30)
    tmp32 = tl.where(tmp26, tmp8, tmp31)
    tmp33 = triton_helpers.maximum(tmp25, tmp32)
    tmp37 = tmp35 + tmp36
    tmp38 = tmp37 * tmp5
    tmp39 = tl.where(tmp34, tmp37, tmp38)
    tmp40 = tl.where(tmp0, tmp8, tmp39)
    tmp43 = tmp42 + tmp36
    tmp44 = tmp43 * tmp5
    tmp45 = tl.where(tmp41, tmp43, tmp44)
    tmp46 = tl.where(tmp10, tmp8, tmp45)
    tmp47 = triton_helpers.maximum(tmp40, tmp46)
    tmp50 = tmp49 + tmp36
    tmp51 = tmp50 * tmp5
    tmp52 = tl.where(tmp48, tmp50, tmp51)
    tmp53 = tl.where(tmp18, tmp8, tmp52)
    tmp54 = triton_helpers.maximum(tmp47, tmp53)
    tmp57 = tmp56 + tmp36
    tmp58 = tmp57 * tmp5
    tmp59 = tl.where(tmp55, tmp57, tmp58)
    tmp60 = tl.where(tmp26, tmp8, tmp59)
    tmp61 = triton_helpers.maximum(tmp54, tmp60)
    tmp65 = tmp63 + tmp64
    tmp66 = tmp65 * tmp5
    tmp67 = tl.where(tmp62, tmp65, tmp66)
    tmp68 = tl.where(tmp0, tmp8, tmp67)
    tmp71 = tmp70 + tmp64
    tmp72 = tmp71 * tmp5
    tmp73 = tl.where(tmp69, tmp71, tmp72)
    tmp74 = tl.where(tmp10, tmp8, tmp73)
    tmp75 = triton_helpers.maximum(tmp68, tmp74)
    tmp78 = tmp77 + tmp64
    tmp79 = tmp78 * tmp5
    tmp80 = tl.where(tmp76, tmp78, tmp79)
    tmp81 = tl.where(tmp18, tmp8, tmp80)
    tmp82 = triton_helpers.maximum(tmp75, tmp81)
    tmp85 = tmp84 + tmp64
    tmp86 = tmp85 * tmp5
    tmp87 = tl.where(tmp83, tmp85, tmp86)
    tmp88 = tl.where(tmp26, tmp8, tmp87)
    tmp89 = triton_helpers.maximum(tmp82, tmp88)
    tmp93 = tmp91 + tmp92
    tmp94 = tmp93 * tmp5
    tmp95 = tl.where(tmp90, tmp93, tmp94)
    tmp96 = tl.where(tmp0, tmp8, tmp95)
    tmp99 = tmp98 + tmp92
    tmp100 = tmp99 * tmp5
    tmp101 = tl.where(tmp97, tmp99, tmp100)
    tmp102 = tl.where(tmp10, tmp8, tmp101)
    tmp103 = triton_helpers.maximum(tmp96, tmp102)
    tmp106 = tmp105 + tmp92
    tmp107 = tmp106 * tmp5
    tmp108 = tl.where(tmp104, tmp106, tmp107)
    tmp109 = tl.where(tmp18, tmp8, tmp108)
    tmp110 = triton_helpers.maximum(tmp103, tmp109)
    tmp113 = tmp112 + tmp92
    tmp114 = tmp113 * tmp5
    tmp115 = tl.where(tmp111, tmp113, tmp114)
    tmp116 = tl.where(tmp26, tmp8, tmp115)
    tmp117 = triton_helpers.maximum(tmp110, tmp116)
    tl.store(out_ptr0 + x5, tmp33, xmask)
    tl.store(out_ptr1 + x5, tmp61, xmask)
    tl.store(out_ptr2 + x5, tmp89, xmask)
    tl.store(out_ptr3 + x5, tmp117, xmask)


@triton.jit
def triton_poi_fused__softmax_add_leaky_relu_masked_fill_3(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, in_ptr13, in_ptr14, in_ptr15, in_ptr16,
    out_ptr0, out_ptr1, out_ptr2, out_ptr3, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x4 = xindex
    x5 = xindex % 64
    x6 = xindex // 4 % 16
    x0 = xindex % 4
    x2 = xindex // 16 % 4
    x7 = xindex // 16
    tmp0 = tl.load(in_ptr0 + x4, xmask).to(tl.int1)
    tmp1 = tl.load(in_ptr1 + x5, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp2 = tl.load(in_ptr2 + x6, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr3 + (x0 + 4 * x2), xmask, eviction_policy='evict_last'
        )
    tmp10 = tl.load(in_ptr4 + (x0 + 4 * x7), xmask, eviction_policy=
        'evict_last')
    tmp13 = tl.load(in_ptr5 + x5, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp14 = tl.load(in_ptr6 + x6, xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr7 + (x0 + 4 * x2), xmask, eviction_policy=
        'evict_last')
    tmp20 = tl.load(in_ptr8 + (x0 + 4 * x7), xmask, eviction_policy=
        'evict_last')
    tmp23 = tl.load(in_ptr9 + x5, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp24 = tl.load(in_ptr10 + x6, xmask, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr11 + (x0 + 4 * x2), xmask, eviction_policy=
        'evict_last')
    tmp30 = tl.load(in_ptr12 + (x0 + 4 * x7), xmask, eviction_policy=
        'evict_last')
    tmp33 = tl.load(in_ptr13 + x5, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp34 = tl.load(in_ptr14 + x6, xmask, eviction_policy='evict_last')
    tmp35 = tl.load(in_ptr15 + (x0 + 4 * x2), xmask, eviction_policy=
        'evict_last')
    tmp40 = tl.load(in_ptr16 + (x0 + 4 * x7), xmask, eviction_policy=
        'evict_last')
    tmp4 = tmp2 + tmp3
    tmp5 = 4.0
    tmp6 = tmp4 * tmp5
    tmp7 = tl.where(tmp1, tmp4, tmp6)
    tmp8 = -1000000000.0
    tmp9 = tl.where(tmp0, tmp8, tmp7)
    tmp11 = tmp9 - tmp10
    tmp12 = tl_math.exp(tmp11)
    tmp16 = tmp14 + tmp15
    tmp17 = tmp16 * tmp5
    tmp18 = tl.where(tmp13, tmp16, tmp17)
    tmp19 = tl.where(tmp0, tmp8, tmp18)
    tmp21 = tmp19 - tmp20
    tmp22 = tl_math.exp(tmp21)
    tmp26 = tmp24 + tmp25
    tmp27 = tmp26 * tmp5
    tmp28 = tl.where(tmp23, tmp26, tmp27)
    tmp29 = tl.where(tmp0, tmp8, tmp28)
    tmp31 = tmp29 - tmp30
    tmp32 = tl_math.exp(tmp31)
    tmp36 = tmp34 + tmp35
    tmp37 = tmp36 * tmp5
    tmp38 = tl.where(tmp33, tmp36, tmp37)
    tmp39 = tl.where(tmp0, tmp8, tmp38)
    tmp41 = tmp39 - tmp40
    tmp42 = tl_math.exp(tmp41)
    tl.store(out_ptr0 + x4, tmp12, xmask)
    tl.store(out_ptr1 + x4, tmp22, xmask)
    tl.store(out_ptr2 + x4, tmp32, xmask)
    tl.store(out_ptr3 + x4, tmp42, xmask)


@triton.jit
def triton_poi_fused__softmax_4(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x0 = xindex % 4
    x2 = xindex // 16
    tmp0 = tl.load(in_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp2 = tl.load(in_ptr0 + (4 + x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp4 = tl.load(in_ptr0 + (8 + x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp6 = tl.load(in_ptr0 + (12 + x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp3 = tmp1 + tmp2
    tmp5 = tmp3 + tmp4
    tmp7 = tmp5 + tmp6
    tmp8 = tmp0 / tmp7
    tl.store(out_ptr0 + x3, tmp8, xmask)


@triton.jit
def triton_poi_fused_clone_5(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 64
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')
    tl.store(out_ptr0 + x2, tmp0, xmask)


@triton.jit
def triton_poi_fused_stack_6(in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 4 % 16
    x0 = xindex % 4
    x2 = xindex // 64
    x3 = xindex
    tmp0 = x1
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x0 + 4 * x1 + 16 * x2), tmp4 & xmask, 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 + (x0 + 4 * (-4 + x1) + 16 * x2), tmp18 & xmask,
        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 + (x0 + 4 * (-8 + x1) + 16 * x2), tmp30 & xmask,
        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 + (x0 + 4 * (-12 + x1) + 16 * x2), tmp39 &
        xmask, 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 + x3, tmp52, xmask)


@triton.jit
def triton_poi_fused_sum_7(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 16
    x1 = xindex // 16
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 64 * x1), xmask)
    tmp1 = tl.load(in_ptr0 + (16 + x0 + 64 * x1), xmask)
    tmp3 = tl.load(in_ptr0 + (32 + x0 + 64 * x1), xmask)
    tmp5 = tl.load(in_ptr0 + (48 + x0 + 64 * x1), xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tl.store(out_ptr0 + x2, tmp6, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10, primals_11, primals_12,
        primals_13, primals_14) = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_2, (4, 4), (4, 1))
    assert_size_stride(primals_3, (4, 1), (1, 1))
    assert_size_stride(primals_4, (4, 1), (1, 1))
    assert_size_stride(primals_5, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_6, (4, 4), (4, 1))
    assert_size_stride(primals_7, (4, 1), (1, 1))
    assert_size_stride(primals_8, (4, 1), (1, 1))
    assert_size_stride(primals_9, (4, 4), (4, 1))
    assert_size_stride(primals_10, (4, 1), (1, 1))
    assert_size_stride(primals_11, (4, 1), (1, 1))
    assert_size_stride(primals_12, (4, 4), (4, 1))
    assert_size_stride(primals_13, (4, 1), (1, 1))
    assert_size_stride(primals_14, (4, 1), (1, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0),
            reinterpret_tensor(primals_2, (4, 4), (1, 4), 0), out=buf0)
        del primals_2
        buf1 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf0, primals_3, out=buf1)
        buf2 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf0, primals_4, out=buf2)
        buf3 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        get_raw_stream(0)
        triton_poi_fused_add_leaky_relu_0[grid(64)](buf1, buf2, buf3, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        buf4 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        triton_poi_fused_eq_1[grid(256)](primals_5, buf4, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        del primals_5
        buf10 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0),
            reinterpret_tensor(primals_6, (4, 4), (1, 4), 0), out=buf10)
        del primals_6
        buf11 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf10, primals_7, out=buf11)
        buf12 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf10, primals_8, out=buf12)
        buf13 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        triton_poi_fused_add_leaky_relu_0[grid(64)](buf11, buf12, buf13, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        buf19 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0),
            reinterpret_tensor(primals_9, (4, 4), (1, 4), 0), out=buf19)
        del primals_9
        buf20 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf19, primals_10, out=buf20)
        buf21 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf19, primals_11, out=buf21)
        buf22 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        triton_poi_fused_add_leaky_relu_0[grid(64)](buf20, buf21, buf22, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        buf28 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0),
            reinterpret_tensor(primals_12, (4, 4), (1, 4), 0), out=buf28)
        del primals_12
        buf29 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf28, primals_13, out=buf29)
        buf30 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf28, primals_14, out=buf30)
        buf31 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        triton_poi_fused_add_leaky_relu_0[grid(64)](buf29, buf30, buf31, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        buf5 = empty_strided_cuda((4, 4, 1, 4), (16, 4, 64, 1), torch.float32)
        buf14 = empty_strided_cuda((4, 4, 1, 4), (16, 4, 64, 1), torch.float32)
        buf23 = empty_strided_cuda((4, 4, 1, 4), (16, 4, 64, 1), torch.float32)
        buf32 = empty_strided_cuda((4, 4, 1, 4), (16, 4, 64, 1), torch.float32)
        triton_poi_fused__softmax_add_leaky_relu_masked_fill_2[grid(64)](buf4,
            buf3, buf1, buf2, buf13, buf11, buf12, buf22, buf20, buf21,
            buf31, buf29, buf30, buf5, buf14, buf23, buf32, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf6 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf15 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf24 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf33 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused__softmax_add_leaky_relu_masked_fill_3[grid(256)](buf4,
            buf3, buf1, buf2, buf5, buf13, buf11, buf12, buf14, buf22,
            buf20, buf21, buf23, buf31, buf29, buf30, buf32, buf6, buf15,
            buf24, buf33, 256, XBLOCK=128, num_warps=4, num_stages=1)
        del buf1
        del buf11
        del buf12
        del buf14
        del buf2
        del buf20
        del buf21
        del buf23
        del buf29
        del buf30
        del buf32
        del buf5
        buf7 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused__softmax_4[grid(256)](buf6, buf7, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf8 = buf6
        del buf6
        triton_poi_fused_clone_5[grid(256)](buf0, buf8, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf9 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf7, (16, 4, 4), (16, 4, 1),
            0), reinterpret_tensor(buf8, (16, 4, 4), (16, 4, 1), 0), out=buf9)
        buf16 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused__softmax_4[grid(256)](buf15, buf16, 256, XBLOCK=
            128, num_warps=4, num_stages=1)
        buf17 = buf15
        del buf15
        triton_poi_fused_clone_5[grid(256)](buf10, buf17, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf18 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf16, (16, 4, 4), (16, 4, 1),
            0), reinterpret_tensor(buf17, (16, 4, 4), (16, 4, 1), 0), out=buf18
            )
        buf25 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused__softmax_4[grid(256)](buf24, buf25, 256, XBLOCK=
            128, num_warps=4, num_stages=1)
        buf26 = buf24
        del buf24
        triton_poi_fused_clone_5[grid(256)](buf19, buf26, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf27 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf25, (16, 4, 4), (16, 4, 1),
            0), reinterpret_tensor(buf26, (16, 4, 4), (16, 4, 1), 0), out=buf27
            )
        buf34 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused__softmax_4[grid(256)](buf33, buf34, 256, XBLOCK=
            128, num_warps=4, num_stages=1)
        buf35 = buf33
        del buf33
        triton_poi_fused_clone_5[grid(256)](buf28, buf35, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf36 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf34, (16, 4, 4), (16, 4, 1),
            0), reinterpret_tensor(buf35, (16, 4, 4), (16, 4, 1), 0), out=buf36
            )
        buf37 = empty_strided_cuda((4, 4, 16, 4), (256, 64, 4, 1), torch.
            float32)
        triton_poi_fused_stack_6[grid(1024)](buf9, buf18, buf27, buf36,
            buf37, 1024, XBLOCK=128, num_warps=4, num_stages=1)
        buf38 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_sum_7[grid(256)](buf37, buf38, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        del buf37
    return (buf38, reinterpret_tensor(primals_1, (16, 4), (4, 1), 0), buf3,
        buf4, buf7, buf9, buf13, buf16, buf18, buf22, buf25, buf27, buf31,
        buf34, buf36, reinterpret_tensor(buf35, (16, 4, 4), (16, 1, 4), 0),
        reinterpret_tensor(buf28, (4, 16), (1, 4), 0), reinterpret_tensor(
        primals_14, (1, 4), (1, 1), 0), reinterpret_tensor(primals_13, (1, 
        4), (1, 1), 0), reinterpret_tensor(buf26, (16, 4, 4), (16, 1, 4), 0
        ), reinterpret_tensor(buf19, (4, 16), (1, 4), 0),
        reinterpret_tensor(primals_11, (1, 4), (1, 1), 0),
        reinterpret_tensor(primals_10, (1, 4), (1, 1), 0),
        reinterpret_tensor(buf17, (16, 4, 4), (16, 1, 4), 0),
        reinterpret_tensor(buf10, (4, 16), (1, 4), 0), reinterpret_tensor(
        primals_8, (1, 4), (1, 1), 0), reinterpret_tensor(primals_7, (1, 4),
        (1, 1), 0), reinterpret_tensor(buf8, (16, 4, 4), (16, 1, 4), 0),
        reinterpret_tensor(buf0, (4, 16), (1, 4), 0), reinterpret_tensor(
        primals_4, (1, 4), (1, 1), 0), reinterpret_tensor(primals_3, (1, 4),
        (1, 1), 0))


class GraphAttentionLayer(nn.Module):

    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.Linear(in_features, out_features, bias=False)
        nn.init.xavier_uniform_(self.W.weight, gain=1.414)
        self.a1 = nn.Parameter(torch.zeros(size=(out_features, 1)))
        self.a2 = nn.Parameter(torch.zeros(size=(out_features, 1)))
        nn.init.xavier_uniform_(self.a1.data, gain=1.414)
        nn.init.xavier_uniform_(self.a2.data, gain=1.414)
        self.leakyrelu = nn.LeakyReLU(self.alpha)

    def forward(self, input, adj):
        h = self.W(input)
        _batch_size, N, _ = h.size()
        middle_result1 = torch.matmul(h, self.a1).expand(-1, -1, N)
        middle_result2 = torch.matmul(h, self.a2).expand(-1, -1, N).transpose(
            1, 2)
        e = self.leakyrelu(middle_result1 + middle_result2)
        attention = e.masked_fill(adj == 0, -1000000000.0)
        attention = F.softmax(attention, dim=2)
        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, out_dim, dropout, alpha, nheads, layer):
        super(GATNew, self).__init__()
        self.dropout = dropout
        self.layer = layer
        if self.layer == 1:
            self.attentions = [GraphAttentionLayer(nfeat, out_dim, dropout=
                dropout, alpha=alpha, concat=True) for _ in range(nheads)]
        else:
            self.attentions = [GraphAttentionLayer(nfeat, nhid, dropout=
                dropout, alpha=alpha, concat=True) for _ in range(nheads)]
            self.out_att = GraphAttentionLayer(nhid * nheads, out_dim,
                dropout=dropout, alpha=alpha, concat=False)
        for i, attention in enumerate(self.attentions):
            self.add_module('attention_{}'.format(i), attention)

    def forward(self, input_0, input_1):
        primals_3 = self.attention_0.a1
        primals_4 = self.attention_0.a2
        primals_2 = self.attention_0.W.weight
        primals_7 = self.attention_1.a1
        primals_8 = self.attention_1.a2
        primals_6 = self.attention_1.W.weight
        primals_10 = self.attention_2.a1
        primals_11 = self.attention_2.a2
        primals_9 = self.attention_2.W.weight
        primals_13 = self.attention_3.a1
        primals_14 = self.attention_3.a2
        primals_12 = self.attention_3.W.weight
        primals_1 = input_0
        primals_5 = input_1
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9,
            primals_10, primals_11, primals_12, primals_13, primals_14])
        return output[0]
