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

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


# kernel path: runs/run_shard_7/inductor_cache/7n/c7nlxt7lv2ymidvoden6ljwymxnph6k2wwwgwme3hbkuba5g3ae7.py
# Topologically Sorted Source Nodes: [repeat, repeat_1, sub, a_input], Original ATen: [aten.repeat, aten.sub, aten.abs, aten.sgn]
# Source node to ATen node mapping:
#   a_input => abs_1
#   repeat => repeat
#   repeat_1 => repeat_1
#   sub => sub
# Graph fragment:
#   %repeat : [num_users=1] = call_function[target=torch.ops.aten.repeat.default](args = (%unsqueeze, [4, 1, 1]), kwargs = {})
#   %repeat_1 : [num_users=1] = call_function[target=torch.ops.aten.repeat.default](args = (%unsqueeze_1, [1, 4, 1]), kwargs = {})
#   %sub : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%repeat, %repeat_1), kwargs = {})
#   %abs_1 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub,), kwargs = {})
#   %sign_3 : [num_users=1] = call_function[target=torch.ops.aten.sign.default](args = (%sub,), kwargs = {})
triton_poi_fused_abs_repeat_sgn_sub_0 = async_compile.triton('triton_poi_fused_abs_repeat_sgn_sub_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=[2048], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_abs_repeat_sgn_sub_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_abs_repeat_sgn_sub_0(in_ptr0, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 2048
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = tl.full([XBLOCK], True, tl.int1)
    x3 = xindex % 512
    x0 = xindex % 128
    x2 = (xindex // 512)
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + (x3), None, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (x0 + (128*x2)), None, eviction_policy='evict_last')
    tmp2 = tmp0 - tmp1
    tmp3 = tl_math.abs(tmp2)
    tmp4 = tl.full([1], 0, tl.int32)
    tmp5 = tmp4 < tmp2
    tmp6 = tmp5.to(tl.int8)
    tmp7 = tmp2 < tmp4
    tmp8 = tmp7.to(tl.int8)
    tmp9 = tmp6 - tmp8
    tmp10 = tmp9.to(tmp2.dtype)
    tl.store(out_ptr0 + (x4), tmp3, None)
    tl.store(out_ptr1 + (x4), tmp10, None)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/k2/ck2qvrsga6qzh3n4zrcqhgn3gcw55gg5hx55rqebdhhoptcty66e.py
# Topologically Sorted Source Nodes: [gt], Original ATen: [aten.gt]
# Source node to ATen node mapping:
#   gt => gt
# Graph fragment:
#   %gt : [num_users=4] = call_function[target=torch.ops.aten.gt.Scalar](args = (%primals_4, 0), kwargs = {})
triton_poi_fused_gt_1 = async_compile.triton('triton_poi_fused_gt_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_gt_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_gt_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_7/inductor_cache/24/c24kgtmxijly2ixnl5boq5l3fydtuuhudmzon7z53h5pabovbct3.py
# Topologically Sorted Source Nodes: [e, zero_vec, attention, attention_1], Original ATen: [aten.relu, aten.mul, aten.where, aten._softmax]
# Source node to ATen node mapping:
#   attention => where
#   attention_1 => amax, exp, sub_1, sum_1
#   e => relu
#   zero_vec => full_default
# Graph fragment:
#   %relu : [num_users=2] = call_function[target=torch.ops.aten.relu.default](args = (%squeeze,), kwargs = {})
#   %full_default : [num_users=3] = 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 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt, %relu, %full_default), kwargs = {})
#   %amax : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where, [1], True), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where, %amax), kwargs = {})
#   %exp : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_1,), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp, [1], True), kwargs = {})
triton_poi_fused__softmax_mul_relu_where_2 = async_compile.triton('triton_poi_fused__softmax_mul_relu_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: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__softmax_mul_relu_where_2', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 8, '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_mul_relu_where_2(in_ptr0, in_ptr1, 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')
    tmp6 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp7 = tl.load(in_ptr1 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp12 = tl.load(in_ptr1 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last').to(tl.int1)
    tmp17 = tl.load(in_ptr1 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp2 = tl.full([1], 0, tl.int32)
    tmp3 = triton_helpers.maximum(tmp2, tmp1)
    tmp4 = -8999999815811072.0
    tmp5 = tl.where(tmp0, tmp3, tmp4)
    tmp8 = triton_helpers.maximum(tmp2, tmp7)
    tmp9 = tl.where(tmp6, tmp8, tmp4)
    tmp10 = triton_helpers.maximum(tmp5, tmp9)
    tmp13 = triton_helpers.maximum(tmp2, tmp12)
    tmp14 = tl.where(tmp11, tmp13, tmp4)
    tmp15 = triton_helpers.maximum(tmp10, tmp14)
    tmp18 = triton_helpers.maximum(tmp2, tmp17)
    tmp19 = tl.where(tmp16, tmp18, tmp4)
    tmp20 = triton_helpers.maximum(tmp15, tmp19)
    tmp21 = tmp5 - tmp20
    tmp22 = tl_math.exp(tmp21)
    tmp23 = tmp9 - tmp20
    tmp24 = tl_math.exp(tmp23)
    tmp25 = tmp22 + tmp24
    tmp26 = tmp14 - tmp20
    tmp27 = tl_math.exp(tmp26)
    tmp28 = tmp25 + tmp27
    tmp29 = tmp19 - tmp20
    tmp30 = tl_math.exp(tmp29)
    tmp31 = tmp28 + tmp30
    tl.store(out_ptr0 + (x0), tmp20, xmask)
    tl.store(out_ptr1 + (x0), tmp31, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/dg/cdgttj5wetiapnfmuoyma7v5qsakp3k4ghmgomzythzlapxeajm6.py
# Topologically Sorted Source Nodes: [e, zero_vec, attention, attention_1], Original ATen: [aten.relu, aten.mul, aten.where, aten._softmax, aten.threshold_backward]
# Source node to ATen node mapping:
#   attention => where
#   attention_1 => amax, div, exp, sub_1
#   e => relu
#   zero_vec => full_default
# Graph fragment:
#   %relu : [num_users=2] = call_function[target=torch.ops.aten.relu.default](args = (%squeeze,), kwargs = {})
#   %full_default : [num_users=3] = 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 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt, %relu, %full_default), kwargs = {})
#   %amax : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%where, [1], True), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%where, %amax), kwargs = {})
#   %exp : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_1,), kwargs = {})
#   %div : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp, %sum_1), kwargs = {})
#   %le_5 : [num_users=1] = call_function[target=torch.ops.aten.le.Scalar](args = (%relu, 0), kwargs = {})
triton_poi_fused__softmax_mul_relu_threshold_backward_where_3 = async_compile.triton('triton_poi_fused__softmax_mul_relu_threshold_backward_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: '*i1', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*i1', 6: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__softmax_mul_relu_threshold_backward_where_3', '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__softmax_mul_relu_threshold_backward_where_3(in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0, out_ptr1, 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)
    tmp6 = tl.load(in_ptr2 + (x1), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr3 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tl.full([1], 0, tl.int32)
    tmp3 = triton_helpers.maximum(tmp2, tmp1)
    tmp4 = -8999999815811072.0
    tmp5 = tl.where(tmp0, tmp3, tmp4)
    tmp7 = tmp5 - tmp6
    tmp8 = tl_math.exp(tmp7)
    tmp10 = tmp8 / tmp9
    tmp11 = 0.0
    tmp12 = tmp3 <= tmp11
    tl.store(out_ptr0 + (x2), tmp10, xmask)
    tl.store(out_ptr1 + (x2), tmp12, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/qv/cqvn65ibkjrlfzwuaha5jcy7542wxhj4hk7ogd354htwtyshseem.py
# Topologically Sorted Source Nodes: [x], Original ATen: [aten.relu]
# Source node to ATen node mapping:
#   x => relu_1
# Graph fragment:
#   %relu_1 : [num_users=2] = call_function[target=torch.ops.aten.relu.default](args = (%mm_2,), kwargs = {})
triton_poi_fused_relu_4 = async_compile.triton('triton_poi_fused_relu_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=[512], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_relu_4', 'mutated_arg_names': ['in_out_ptr0'], '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_relu_4(in_out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tl.store(in_out_ptr0 + (x0), tmp2, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/pe/cpe2fn2ekq2v6vx5ktgalvl3dywenbssl3bxnbmmdzsss3sdztwm.py
# Topologically Sorted Source Nodes: [repeat_6, repeat_7, sub_3, feat_diff], Original ATen: [aten.repeat, aten.sub, aten.abs, aten.sgn]
# Source node to ATen node mapping:
#   feat_diff => abs_4
#   repeat_6 => repeat_6
#   repeat_7 => repeat_7
#   sub_3 => sub_6
# Graph fragment:
#   %repeat_6 : [num_users=1] = call_function[target=torch.ops.aten.repeat.default](args = (%unsqueeze_6, [4, 1, 1]), kwargs = {})
#   %repeat_7 : [num_users=1] = call_function[target=torch.ops.aten.repeat.default](args = (%unsqueeze_7, [1, 4, 1]), kwargs = {})
#   %sub_6 : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%repeat_6, %repeat_7), kwargs = {})
#   %abs_4 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_6,), kwargs = {})
#   %sign : [num_users=1] = call_function[target=torch.ops.aten.sign.default](args = (%sub_6,), kwargs = {})
triton_poi_fused_abs_repeat_sgn_sub_5 = async_compile.triton('triton_poi_fused_abs_repeat_sgn_sub_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=[2048], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_abs_repeat_sgn_sub_5', '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_abs_repeat_sgn_sub_5(in_ptr0, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 2048
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = tl.full([XBLOCK], True, tl.int1)
    x3 = xindex % 512
    x0 = xindex % 128
    x2 = (xindex // 512)
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + (x3), None, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (x0 + (128*x2)), None, eviction_policy='evict_last')
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp4 = triton_helpers.maximum(tmp1, tmp3)
    tmp5 = tmp2 - tmp4
    tmp6 = tl_math.abs(tmp5)
    tmp7 = tmp1 < tmp5
    tmp8 = tmp7.to(tl.int8)
    tmp9 = tmp5 < tmp1
    tmp10 = tmp9.to(tl.int8)
    tmp11 = tmp8 - tmp10
    tmp12 = tmp11.to(tmp5.dtype)
    tl.store(out_ptr0 + (x4), tmp6, None)
    tl.store(out_ptr1 + (x4), tmp12, None)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/k4/ck4fjenyfjidd4znygnuktfundwe4kc4ysjizfxaoiqctd2ye4xc.py
# Topologically Sorted Source Nodes: [x_2], Original ATen: [aten.relu, aten.threshold_backward]
# Source node to ATen node mapping:
#   x_2 => relu_5
# Graph fragment:
#   %relu_5 : [num_users=3] = call_function[target=torch.ops.aten.relu.default](args = (%mm_8,), kwargs = {})
#   %le : [num_users=1] = call_function[target=torch.ops.aten.le.Scalar](args = (%relu_5, 0), kwargs = {})
triton_poi_fused_relu_threshold_backward_6 = async_compile.triton('triton_poi_fused_relu_threshold_backward_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=[512], 
    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_relu_threshold_backward_6', '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_relu_threshold_backward_6(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), xmask)
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp3 = 0.0
    tmp4 = tmp2 <= tmp3
    tl.store(out_ptr0 + (x0), tmp4, xmask)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

def call(args):
    primals_1, primals_2, primals_3, primals_4, primals_5, primals_6, primals_7, primals_8, primals_9, primals_10 = args
    args.clear()
    assert_size_stride(primals_1, (4, 128), (128, 1))
    assert_size_stride(primals_2, (4, 4), (4, 1))
    assert_size_stride(primals_3, (128, 1), (1, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    assert_size_stride(primals_5, (128, 128), (128, 1))
    assert_size_stride(primals_6, (128, 1), (1, 1))
    assert_size_stride(primals_7, (128, 128), (128, 1))
    assert_size_stride(primals_8, (128, 1), (1, 1))
    assert_size_stride(primals_9, (4, 128), (128, 1))
    assert_size_stride(primals_10, (4, ), (1, ))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h], Original ATen: [aten.mm]
        extern_kernels.mm(primals_2, primals_1, out=buf0)
        del primals_1
        buf1 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        buf33 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [repeat, repeat_1, sub, a_input], Original ATen: [aten.repeat, aten.sub, aten.abs, aten.sgn]
        stream0 = get_raw_stream(0)
        triton_poi_fused_abs_repeat_sgn_sub_0.run(buf0, buf1, buf33, 2048, grid=grid(2048), stream=stream0)
        buf2 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [matmul], Original ATen: [aten.mm]
        extern_kernels.mm(reinterpret_tensor(buf1, (16, 128), (128, 1), 0), primals_3, out=buf2)
        buf3 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [gt], Original ATen: [aten.gt]
        triton_poi_fused_gt_1.run(primals_4, buf3, 16, grid=grid(16), stream=stream0)
        del primals_4
        buf4 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf5 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        # Topologically Sorted Source Nodes: [e, zero_vec, attention, attention_1], Original ATen: [aten.relu, aten.mul, aten.where, aten._softmax]
        triton_poi_fused__softmax_mul_relu_where_2.run(buf3, buf2, buf4, buf5, 4, grid=grid(4), stream=stream0)
        buf6 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        buf32 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [e, zero_vec, attention, attention_1], Original ATen: [aten.relu, aten.mul, aten.where, aten._softmax, aten.threshold_backward]
        triton_poi_fused__softmax_mul_relu_threshold_backward_where_3.run(buf3, buf2, buf4, buf5, buf6, buf32, 16, grid=grid(16), stream=stream0)
        buf7 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_1], Original ATen: [aten.mm]
        extern_kernels.mm(buf6, buf0, out=buf7)
        buf8 = buf7; del buf7  # reuse
        # Topologically Sorted Source Nodes: [x], Original ATen: [aten.relu]
        triton_poi_fused_relu_4.run(buf8, 512, grid=grid(512), stream=stream0)
        buf9 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_2], Original ATen: [aten.mm]
        extern_kernels.mm(buf8, primals_5, out=buf9)
        buf10 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        buf31 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [repeat_2, repeat_3, sub_1, a_input_1], Original ATen: [aten.repeat, aten.sub, aten.abs, aten.sgn]
        triton_poi_fused_abs_repeat_sgn_sub_0.run(buf9, buf10, buf31, 2048, grid=grid(2048), stream=stream0)
        buf11 = buf2; del buf2  # reuse
        # Topologically Sorted Source Nodes: [matmul_2], Original ATen: [aten.mm]
        extern_kernels.mm(reinterpret_tensor(buf10, (16, 128), (128, 1), 0), primals_6, out=buf11)
        buf12 = buf5; del buf5  # reuse
        buf13 = buf4; del buf4  # reuse
        # Topologically Sorted Source Nodes: [zero_vec, e_1, attention_3, attention_4], Original ATen: [aten.mul, aten.relu, aten.where, aten._softmax]
        triton_poi_fused__softmax_mul_relu_where_2.run(buf3, buf11, buf12, buf13, 4, grid=grid(4), stream=stream0)
        buf14 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        buf30 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [zero_vec, e_1, attention_3, attention_4], Original ATen: [aten.mul, aten.relu, aten.where, aten._softmax, aten.threshold_backward]
        triton_poi_fused__softmax_mul_relu_threshold_backward_where_3.run(buf3, buf11, buf12, buf13, buf14, buf30, 16, grid=grid(16), stream=stream0)
        buf15 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_3], Original ATen: [aten.mm]
        extern_kernels.mm(buf14, buf9, out=buf15)
        buf16 = buf15; del buf15  # reuse
        # Topologically Sorted Source Nodes: [x_1], Original ATen: [aten.relu]
        triton_poi_fused_relu_4.run(buf16, 512, grid=grid(512), stream=stream0)
        buf17 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_4], Original ATen: [aten.mm]
        extern_kernels.mm(buf16, primals_7, out=buf17)
        buf18 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        buf29 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [repeat_4, repeat_5, sub_2, a_input_2], Original ATen: [aten.repeat, aten.sub, aten.abs, aten.sgn]
        triton_poi_fused_abs_repeat_sgn_sub_0.run(buf17, buf18, buf29, 2048, grid=grid(2048), stream=stream0)
        buf19 = buf11; del buf11  # reuse
        # Topologically Sorted Source Nodes: [matmul_4], Original ATen: [aten.mm]
        extern_kernels.mm(reinterpret_tensor(buf18, (16, 128), (128, 1), 0), primals_8, out=buf19)
        buf20 = buf13; del buf13  # reuse
        buf21 = buf12; del buf12  # reuse
        # Topologically Sorted Source Nodes: [zero_vec, e_2, attention_6, attention_7], Original ATen: [aten.mul, aten.relu, aten.where, aten._softmax]
        triton_poi_fused__softmax_mul_relu_where_2.run(buf3, buf19, buf20, buf21, 4, grid=grid(4), stream=stream0)
        buf22 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        buf28 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [zero_vec, e_2, attention_6, attention_7], Original ATen: [aten.mul, aten.relu, aten.where, aten._softmax, aten.threshold_backward]
        triton_poi_fused__softmax_mul_relu_threshold_backward_where_3.run(buf3, buf19, buf20, buf21, buf22, buf28, 16, grid=grid(16), stream=stream0)
        del buf19
        del buf20
        del buf21
        buf23 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [h_5], Original ATen: [aten.mm]
        extern_kernels.mm(buf22, buf17, out=buf23)
        buf24 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        buf26 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [repeat_6, repeat_7, sub_3, feat_diff], Original ATen: [aten.repeat, aten.sub, aten.abs, aten.sgn]
        triton_poi_fused_abs_repeat_sgn_sub_5.run(buf23, buf24, buf26, 2048, grid=grid(2048), stream=stream0)
        buf25 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [output], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_10, reinterpret_tensor(buf24, (16, 128), (128, 1), 0), reinterpret_tensor(primals_9, (128, 4), (1, 128), 0), alpha=1, beta=1, out=buf25)
        del primals_10
        buf27 = empty_strided_cuda((4, 128), (128, 1), torch.bool)
        # Topologically Sorted Source Nodes: [x_2], Original ATen: [aten.relu, aten.threshold_backward]
        triton_poi_fused_relu_threshold_backward_6.run(buf23, buf27, 512, grid=grid(512), stream=stream0)
        del buf23
    return (buf25, buf3, buf6, buf8, buf14, buf16, buf22, reinterpret_tensor(buf24, (16, 128), (128, 1), 0), primals_9, buf26, buf27, reinterpret_tensor(buf17, (128, 4), (1, 128), 0), buf28, reinterpret_tensor(buf18, (128, 16), (1, 128), 0), reinterpret_tensor(primals_8, (1, 128), (1, 1), 0), buf29, reinterpret_tensor(primals_7, (128, 128), (1, 128), 0), reinterpret_tensor(buf9, (128, 4), (1, 128), 0), buf30, reinterpret_tensor(buf10, (128, 16), (1, 128), 0), reinterpret_tensor(primals_6, (1, 128), (1, 1), 0), buf31, reinterpret_tensor(primals_5, (128, 128), (1, 128), 0), reinterpret_tensor(buf0, (128, 4), (1, 128), 0), buf32, reinterpret_tensor(buf1, (128, 16), (1, 128), 0), reinterpret_tensor(primals_3, (1, 128), (1, 1), 0), buf33, reinterpret_tensor(primals_2, (4, 4), (1, 4), 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, 128), (128, 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((128, 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((128, 128), (128, 1), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((128, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((128, 128), (128, 1), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((128, 1), (1, 1), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((4, 128), (128, 1), device='cuda:0', dtype=torch.float32)
    primals_10 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([primals_1, primals_2, primals_3, primals_4, primals_5, primals_6, primals_7, primals_8, primals_9, primals_10])
    return print_performance(fn, times=times, repeat=repeat)


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

from torch.nn import Module
import torch
from torch.nn.modules.module import Module
import torch.nn as nn
import torch.nn.functional as F


class EdgeGCN(Module):
    """
    Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
    """

    def __init__(self, in_features, out_features, include_adj=True, bias=True):
        super(EdgeGCN, self).__init__()
        self.include_adj = include_adj
        self.in_features = in_features + 1 if self.include_adj else in_features
        self.out_features = out_features
        self.fc = nn.Linear(self.in_features, self.out_features, bias=bias)

    def forward(self, feat, adj):
        feat_diff = (feat.unsqueeze(0).repeat(feat.shape[0], 1, 1) - feat.
            unsqueeze(1).repeat(1, feat.shape[0], 1)).abs()
        if self.include_adj:
            x = torch.cat((feat_diff, adj.unsqueeze(2)), 2).view(feat.shape
                [0] * feat.shape[0], -1)
        else:
            x = feat_diff.view(feat.shape[0] * feat.shape[0], -1)
        output = self.fc(x)
        return output

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


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

    def __init__(self, in_features, out_features, dropout=0, alpha=0.2,
        concat=True):
        super(GATLayer, 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=(out_features, 1)))
        nn.init.xavier_uniform_(self.a.data, gain=1.414)

    def forward(self, input, adj):
        h = torch.mm(input, self.W)
        h.size()[0]
        a_input = (h.unsqueeze(0).repeat(h.shape[0], 1, 1) - h.unsqueeze(1)
            .repeat(1, h.shape[0], 1)).abs()
        e = F.relu(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 = torch.matmul(attention, h)
        if self.concat:
            return F.relu(h)
        else:
            return h

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


class GAT(nn.Module):

    def __init__(self, nfeat, nclass):
        super(GAT, self).__init__()
        self.gat1 = GATLayer(nfeat, 128)
        self.gat2 = GATLayer(128, 128)
        self.gat3 = GATLayer(128, 128)
        self.edge_gc = EdgeGCN(128, nclass, include_adj=False)

    def forward(self, feat, adj):
        x = self.gat1(feat, adj)
        x = self.gat2(x, adj)
        x = self.gat3(x, adj)
        a = self.edge_gc(x, adj)
        return a


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


def get_init_inputs():
    return [[], {'nfeat': 4, 'nclass': 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 math as tl_math
from torch.nn import Module
from torch.nn.modules.module import Module
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_abs_repeat_sgn_sub_0(in_ptr0, out_ptr0, out_ptr1,
    xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex % 512
    x0 = xindex % 128
    x2 = xindex // 512
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + x3, None, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (x0 + 128 * x2), None, eviction_policy=
        'evict_last')
    tmp2 = tmp0 - tmp1
    tmp3 = tl_math.abs(tmp2)
    tmp4 = tl.full([1], 0, tl.int32)
    tmp5 = tmp4 < tmp2
    tmp6 = tmp5.to(tl.int8)
    tmp7 = tmp2 < tmp4
    tmp8 = tmp7.to(tl.int8)
    tmp9 = tmp6 - tmp8
    tmp10 = tmp9.to(tmp2.dtype)
    tl.store(out_ptr0 + x4, tmp3, None)
    tl.store(out_ptr1 + x4, tmp10, None)


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


@triton.jit
def triton_poi_fused__softmax_mul_relu_threshold_backward_where_3(in_ptr0,
    in_ptr1, in_ptr2, in_ptr3, out_ptr0, out_ptr1, 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)
    tmp6 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr3 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tl.full([1], 0, tl.int32)
    tmp3 = triton_helpers.maximum(tmp2, tmp1)
    tmp4 = -8999999815811072.0
    tmp5 = tl.where(tmp0, tmp3, tmp4)
    tmp7 = tmp5 - tmp6
    tmp8 = tl_math.exp(tmp7)
    tmp10 = tmp8 / tmp9
    tmp11 = 0.0
    tmp12 = tmp3 <= tmp11
    tl.store(out_ptr0 + x2, tmp10, xmask)
    tl.store(out_ptr1 + x2, tmp12, xmask)


@triton.jit
def triton_poi_fused_relu_4(in_out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_out_ptr0 + x0, xmask)
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tl.store(in_out_ptr0 + x0, tmp2, xmask)


@triton.jit
def triton_poi_fused_abs_repeat_sgn_sub_5(in_ptr0, out_ptr0, out_ptr1,
    xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex % 512
    x0 = xindex % 128
    x2 = xindex // 512
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + x3, None, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (x0 + 128 * x2), None, eviction_policy=
        'evict_last')
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp4 = triton_helpers.maximum(tmp1, tmp3)
    tmp5 = tmp2 - tmp4
    tmp6 = tl_math.abs(tmp5)
    tmp7 = tmp1 < tmp5
    tmp8 = tmp7.to(tl.int8)
    tmp9 = tmp5 < tmp1
    tmp10 = tmp9.to(tl.int8)
    tmp11 = tmp8 - tmp10
    tmp12 = tmp11.to(tmp5.dtype)
    tl.store(out_ptr0 + x4, tmp6, None)
    tl.store(out_ptr1 + x4, tmp12, None)


@triton.jit
def triton_poi_fused_relu_threshold_backward_6(in_ptr0, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask)
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp3 = 0.0
    tmp4 = tmp2 <= tmp3
    tl.store(out_ptr0 + x0, tmp4, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10) = args
    args.clear()
    assert_size_stride(primals_1, (4, 128), (128, 1))
    assert_size_stride(primals_2, (4, 4), (4, 1))
    assert_size_stride(primals_3, (128, 1), (1, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    assert_size_stride(primals_5, (128, 128), (128, 1))
    assert_size_stride(primals_6, (128, 1), (1, 1))
    assert_size_stride(primals_7, (128, 128), (128, 1))
    assert_size_stride(primals_8, (128, 1), (1, 1))
    assert_size_stride(primals_9, (4, 128), (128, 1))
    assert_size_stride(primals_10, (4,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        extern_kernels.mm(primals_2, primals_1, out=buf0)
        del primals_1
        buf1 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        buf33 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_abs_repeat_sgn_sub_0[grid(2048)](buf0, buf1, buf33,
            2048, XBLOCK=128, num_warps=4, num_stages=1)
        buf2 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(buf1, (16, 128), (128, 1), 0),
            primals_3, out=buf2)
        buf3 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_gt_1[grid(16)](primals_4, buf3, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        del primals_4
        buf4 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf5 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        triton_poi_fused__softmax_mul_relu_where_2[grid(4)](buf3, buf2,
            buf4, buf5, 4, XBLOCK=4, num_warps=1, num_stages=1)
        buf6 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        buf32 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused__softmax_mul_relu_threshold_backward_where_3[grid(16)
            ](buf3, buf2, buf4, buf5, buf6, buf32, 16, XBLOCK=16, num_warps
            =1, num_stages=1)
        buf7 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        extern_kernels.mm(buf6, buf0, out=buf7)
        buf8 = buf7
        del buf7
        triton_poi_fused_relu_4[grid(512)](buf8, 512, XBLOCK=256, num_warps
            =4, num_stages=1)
        buf9 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        extern_kernels.mm(buf8, primals_5, out=buf9)
        buf10 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        buf31 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        triton_poi_fused_abs_repeat_sgn_sub_0[grid(2048)](buf9, buf10,
            buf31, 2048, XBLOCK=128, num_warps=4, num_stages=1)
        buf11 = buf2
        del buf2
        extern_kernels.mm(reinterpret_tensor(buf10, (16, 128), (128, 1), 0),
            primals_6, out=buf11)
        buf12 = buf5
        del buf5
        buf13 = buf4
        del buf4
        triton_poi_fused__softmax_mul_relu_where_2[grid(4)](buf3, buf11,
            buf12, buf13, 4, XBLOCK=4, num_warps=1, num_stages=1)
        buf14 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        buf30 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused__softmax_mul_relu_threshold_backward_where_3[grid(16)
            ](buf3, buf11, buf12, buf13, buf14, buf30, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf15 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        extern_kernels.mm(buf14, buf9, out=buf15)
        buf16 = buf15
        del buf15
        triton_poi_fused_relu_4[grid(512)](buf16, 512, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf17 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        extern_kernels.mm(buf16, primals_7, out=buf17)
        buf18 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        buf29 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        triton_poi_fused_abs_repeat_sgn_sub_0[grid(2048)](buf17, buf18,
            buf29, 2048, XBLOCK=128, num_warps=4, num_stages=1)
        buf19 = buf11
        del buf11
        extern_kernels.mm(reinterpret_tensor(buf18, (16, 128), (128, 1), 0),
            primals_8, out=buf19)
        buf20 = buf13
        del buf13
        buf21 = buf12
        del buf12
        triton_poi_fused__softmax_mul_relu_where_2[grid(4)](buf3, buf19,
            buf20, buf21, 4, XBLOCK=4, num_warps=1, num_stages=1)
        buf22 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        buf28 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused__softmax_mul_relu_threshold_backward_where_3[grid(16)
            ](buf3, buf19, buf20, buf21, buf22, buf28, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        del buf19
        del buf20
        del buf21
        buf23 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        extern_kernels.mm(buf22, buf17, out=buf23)
        buf24 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        buf26 = empty_strided_cuda((4, 4, 128), (512, 128, 1), torch.float32)
        triton_poi_fused_abs_repeat_sgn_sub_5[grid(2048)](buf23, buf24,
            buf26, 2048, XBLOCK=256, num_warps=4, num_stages=1)
        buf25 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        extern_kernels.addmm(primals_10, reinterpret_tensor(buf24, (16, 128
            ), (128, 1), 0), reinterpret_tensor(primals_9, (128, 4), (1, 
            128), 0), alpha=1, beta=1, out=buf25)
        del primals_10
        buf27 = empty_strided_cuda((4, 128), (128, 1), torch.bool)
        triton_poi_fused_relu_threshold_backward_6[grid(512)](buf23, buf27,
            512, XBLOCK=256, num_warps=4, num_stages=1)
        del buf23
    return buf25, buf3, buf6, buf8, buf14, buf16, buf22, reinterpret_tensor(
        buf24, (16, 128), (128, 1), 0
        ), primals_9, buf26, buf27, reinterpret_tensor(buf17, (128, 4), (1,
        128), 0), buf28, reinterpret_tensor(buf18, (128, 16), (1, 128), 0
        ), reinterpret_tensor(primals_8, (1, 128), (1, 1), 0
        ), buf29, reinterpret_tensor(primals_7, (128, 128), (1, 128), 0
        ), reinterpret_tensor(buf9, (128, 4), (1, 128), 0
        ), buf30, reinterpret_tensor(buf10, (128, 16), (1, 128), 0
        ), reinterpret_tensor(primals_6, (1, 128), (1, 1), 0
        ), buf31, reinterpret_tensor(primals_5, (128, 128), (1, 128), 0
        ), reinterpret_tensor(buf0, (128, 4), (1, 128), 0
        ), buf32, reinterpret_tensor(buf1, (128, 16), (1, 128), 0
        ), reinterpret_tensor(primals_3, (1, 128), (1, 1), 0
        ), buf33, reinterpret_tensor(primals_2, (4, 4), (1, 4), 0)


class EdgeGCN(Module):
    """
    Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
    """

    def __init__(self, in_features, out_features, include_adj=True, bias=True):
        super(EdgeGCN, self).__init__()
        self.include_adj = include_adj
        self.in_features = in_features + 1 if self.include_adj else in_features
        self.out_features = out_features
        self.fc = nn.Linear(self.in_features, self.out_features, bias=bias)

    def forward(self, feat, adj):
        feat_diff = (feat.unsqueeze(0).repeat(feat.shape[0], 1, 1) - feat.
            unsqueeze(1).repeat(1, feat.shape[0], 1)).abs()
        if self.include_adj:
            x = torch.cat((feat_diff, adj.unsqueeze(2)), 2).view(feat.shape
                [0] * feat.shape[0], -1)
        else:
            x = feat_diff.view(feat.shape[0] * feat.shape[0], -1)
        output = self.fc(x)
        return output

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


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

    def __init__(self, in_features, out_features, dropout=0, alpha=0.2,
        concat=True):
        super(GATLayer, 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=(out_features, 1)))
        nn.init.xavier_uniform_(self.a.data, gain=1.414)

    def forward(self, input, adj):
        h = torch.mm(input, self.W)
        h.size()[0]
        a_input = (h.unsqueeze(0).repeat(h.shape[0], 1, 1) - h.unsqueeze(1)
            .repeat(1, h.shape[0], 1)).abs()
        e = F.relu(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 = torch.matmul(attention, h)
        if self.concat:
            return F.relu(h)
        else:
            return h

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


class GATNew(nn.Module):

    def __init__(self, nfeat, nclass):
        super(GATNew, self).__init__()
        self.gat1 = GATLayer(nfeat, 128)
        self.gat2 = GATLayer(128, 128)
        self.gat3 = GATLayer(128, 128)
        self.edge_gc = EdgeGCN(128, nclass, include_adj=False)

    def forward(self, input_0, input_1):
        primals_1 = self.gat1.W
        primals_3 = self.gat1.a
        primals_5 = self.gat2.W
        primals_6 = self.gat2.a
        primals_7 = self.gat3.W
        primals_8 = self.gat3.a
        primals_9 = self.edge_gc.fc.weight
        primals_10 = self.edge_gc.fc.bias
        primals_2 = input_0
        primals_4 = input_1
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9, primals_10])
        return output[0]
