# 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/bz/cbzaxiqw5wvhy6st3pbxw7pxkl56seuelga6fjbxl6vmuse54t5v.py
# Topologically Sorted Source Nodes: [stack], Original ATen: [aten.stack]
# Source node to ATen node mapping:
#   stack => cat
# Graph fragment:
#   %cat : [num_users=1] = call_function[target=torch.ops.aten.cat.default](args = ([%primals_3, %primals_10, %primals_20, %primals_20, %primals_10],), kwargs = {})
triton_poi_fused_stack_0 = async_compile.triton('triton_poi_fused_stack_0', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

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

@triton_heuristics.pointwise(
    size_hints=[128], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*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, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_stack_0', '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_stack_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 80
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = (xindex // 4)
    x0 = xindex % 4
    x2 = 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)), tmp4 & xmask, other=0.0)
    tmp6 = tmp0 >= tmp3
    tmp7 = tl.full([1], 8, tl.int64)
    tmp8 = tmp0 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tl.load(in_ptr1 + (x0 + (4*((-4) + x1))), tmp9 & xmask, other=0.0)
    tmp11 = tmp0 >= tmp7
    tmp12 = tl.full([1], 12, tl.int64)
    tmp13 = tmp0 < tmp12
    tmp14 = tmp11 & tmp13
    tmp15 = tl.load(in_ptr2 + (x0 + (4*((-8) + x1))), tmp14 & xmask, other=0.0)
    tmp16 = tmp0 >= tmp12
    tmp17 = tl.full([1], 16, tl.int64)
    tmp18 = tmp0 < tmp17
    tmp19 = tmp16 & tmp18
    tmp20 = tl.load(in_ptr2 + (x0 + (4*((-12) + x1))), tmp19 & xmask, other=0.0)
    tmp21 = tmp0 >= tmp17
    tmp22 = tl.full([1], 20, tl.int64)
    tmp23 = tmp0 < tmp22
    tmp24 = tl.load(in_ptr1 + (x0 + (4*((-16) + x1))), tmp21 & xmask, other=0.0)
    tmp25 = tl.where(tmp19, tmp20, tmp24)
    tmp26 = tl.where(tmp14, tmp15, tmp25)
    tmp27 = tl.where(tmp9, tmp10, tmp26)
    tmp28 = tl.where(tmp4, tmp5, tmp27)
    tl.store(out_ptr0 + (x2), tmp28, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/d5/cd5avuhhjsvef6q2smzw7obxl67nlcfoq74e3w3gucxesteng7az.py
# Topologically Sorted Source Nodes: [stack_1], Original ATen: [aten.stack]
# Source node to ATen node mapping:
#   stack_1 => cat_1
# Graph fragment:
#   %cat_1 : [num_users=1] = call_function[target=torch.ops.aten.cat.default](args = ([%primals_1, %primals_8, %primals_22, %primals_18, %primals_15],), kwargs = {})
triton_poi_fused_stack_1 = async_compile.triton('triton_poi_fused_stack_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=[128], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 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_stack_1', '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_stack_1(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 80
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = (xindex // 4)
    x0 = xindex % 4
    x2 = 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)), tmp4 & xmask, other=0.0)
    tmp6 = tmp0 >= tmp3
    tmp7 = tl.full([1], 8, tl.int64)
    tmp8 = tmp0 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tl.load(in_ptr1 + (x0 + (4*((-4) + x1))), tmp9 & xmask, other=0.0)
    tmp11 = tmp0 >= tmp7
    tmp12 = tl.full([1], 12, tl.int64)
    tmp13 = tmp0 < tmp12
    tmp14 = tmp11 & tmp13
    tmp15 = tl.load(in_ptr2 + (x0 + (4*((-8) + x1))), tmp14 & xmask, other=0.0)
    tmp16 = tmp0 >= tmp12
    tmp17 = tl.full([1], 16, tl.int64)
    tmp18 = tmp0 < tmp17
    tmp19 = tmp16 & tmp18
    tmp20 = tl.load(in_ptr3 + (x0 + (4*((-12) + x1))), tmp19 & xmask, other=0.0)
    tmp21 = tmp0 >= tmp17
    tmp22 = tl.full([1], 20, tl.int64)
    tmp23 = tmp0 < tmp22
    tmp24 = tl.load(in_ptr4 + (x0 + (4*((-16) + x1))), tmp21 & xmask, other=0.0)
    tmp25 = tl.where(tmp19, tmp20, tmp24)
    tmp26 = tl.where(tmp14, tmp15, tmp25)
    tmp27 = tl.where(tmp9, tmp10, tmp26)
    tmp28 = tl.where(tmp4, tmp5, tmp27)
    tl.store(out_ptr0 + (x2), tmp28, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/n6/cn6uzhsj4p6y54icvbu7phnuxo4m7pqo3cp3getxhi5452wtzpm5.py
# Topologically Sorted Source Nodes: [stack_2], Original ATen: [aten.stack]
# Source node to ATen node mapping:
#   stack_2 => cat_2
# Graph fragment:
#   %cat_2 : [num_users=1] = call_function[target=torch.ops.aten.cat.default](args = ([%primals_2, %primals_9, %primals_23, %primals_19, %primals_16],), kwargs = {})
triton_poi_fused_stack_2 = async_compile.triton('triton_poi_fused_stack_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=[32], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_stack_2', '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_stack_2(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 20
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tl.full([1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x0), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp6 = tmp0 >= tmp3
    tmp7 = tl.full([1], 8, tl.int64)
    tmp8 = tmp0 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tl.load(in_ptr1 + ((-4) + x0), tmp9 & xmask, eviction_policy='evict_last', other=0.0)
    tmp11 = tmp0 >= tmp7
    tmp12 = tl.full([1], 12, tl.int64)
    tmp13 = tmp0 < tmp12
    tmp14 = tmp11 & tmp13
    tmp15 = tl.load(in_ptr2 + ((-8) + x0), tmp14 & xmask, eviction_policy='evict_last', other=0.0)
    tmp16 = tmp0 >= tmp12
    tmp17 = tl.full([1], 16, tl.int64)
    tmp18 = tmp0 < tmp17
    tmp19 = tmp16 & tmp18
    tmp20 = tl.load(in_ptr3 + ((-12) + x0), tmp19 & xmask, eviction_policy='evict_last', other=0.0)
    tmp21 = tmp0 >= tmp17
    tmp22 = tl.full([1], 20, tl.int64)
    tmp23 = tmp0 < tmp22
    tmp24 = tl.load(in_ptr4 + ((-16) + x0), tmp21 & xmask, eviction_policy='evict_last', other=0.0)
    tmp25 = tl.where(tmp19, tmp20, tmp24)
    tmp26 = tl.where(tmp14, tmp15, tmp25)
    tmp27 = tl.where(tmp9, tmp10, tmp26)
    tmp28 = tl.where(tmp4, tmp5, tmp27)
    tl.store(out_ptr0 + (x0), tmp28, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/t5/ct5rx6v7dkrmt2gksbc2ocdzby4i5tmmwzmibw4x3uf6hyqdv6ko.py
# Topologically Sorted Source Nodes: [n2n_1], Original ATen: [aten.zeros]
# Source node to ATen node mapping:
#   n2n_1 => full
# Graph fragment:
#   %full : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([4, 4], 0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
triton_poi_fused_zeros_3 = async_compile.triton('triton_poi_fused_zeros_3', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

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

@triton_heuristics.pointwise(
    size_hints=[16], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '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_zeros_3', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 0, '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_zeros_3(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 = 0.0
    tl.store(out_ptr0 + (x0), tmp0, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/ev/cevk5nxjhvrl3qc7otvasr4bby7uoclz6akzfj5d3wlqvdd3qpfd.py
# Topologically Sorted Source Nodes: [baddbmm], Original ATen: [aten.baddbmm]
# Source node to ATen node mapping:
#   baddbmm => add
# Graph fragment:
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%unsqueeze, %bmm), kwargs = {})
triton_poi_fused_baddbmm_4 = async_compile.triton('triton_poi_fused_baddbmm_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=[128], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_baddbmm_4', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 2, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_baddbmm_4(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 80
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 4
    x2 = (xindex // 16)
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + (4*x2)), xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_out_ptr0 + (x3), xmask)
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + (x3), tmp2, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/fk/cfkvvmpcu6hrqaxgkxb6lcfetkmrqsw2bz4vnk6fzsje7lnhr26h.py
# Topologically Sorted Source Nodes: [add, relu, X0], Original ATen: [aten.add, aten.relu, aten.mul, aten.threshold_backward]
# Source node to ATen node mapping:
#   X0 => mul
#   add => add_1
#   relu => relu
# Graph fragment:
#   %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%permute_4, %permute_13), kwargs = {})
#   %relu : [num_users=2] = call_function[target=torch.ops.aten.relu.default](args = (%add_1,), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%relu, 0.5), kwargs = {})
#   %le_2 : [num_users=1] = call_function[target=torch.ops.aten.le.Scalar](args = (%relu, 0), kwargs = {})
triton_poi_fused_add_mul_relu_threshold_backward_5 = async_compile.triton('triton_poi_fused_add_mul_relu_threshold_backward_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=[16], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*i1', 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, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_mul_relu_threshold_backward_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_add_mul_relu_threshold_backward_5(in_ptr0, in_ptr1, 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
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), xmask)
    tmp1 = tl.load(in_ptr1 + (x0), xmask)
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.5
    tmp6 = tmp4 * tmp5
    tmp7 = 0.0
    tmp8 = tmp4 <= tmp7
    tl.store(out_ptr0 + (x0), tmp6, xmask)
    tl.store(out_ptr1 + (x0), tmp8, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/hd/chdfete5abdgxaowd5v7sftqfrdzmyxqkhnycwe6ny3eileuwdnt.py
# Topologically Sorted Source Nodes: [add_1, add_2, relu_1, X1], Original ATen: [aten.add, aten.relu, aten.mul, aten.threshold_backward]
# Source node to ATen node mapping:
#   X1 => mul_1
#   add_1 => add_2
#   add_2 => add_3
#   relu_1 => relu_1
# Graph fragment:
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%permute_18, %permute_9), kwargs = {})
#   %add_3 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_2, %permute_30), kwargs = {})
#   %relu_1 : [num_users=2] = call_function[target=torch.ops.aten.relu.default](args = (%add_3,), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%relu_1, 0.3333333333333333), kwargs = {})
#   %le_1 : [num_users=1] = call_function[target=torch.ops.aten.le.Scalar](args = (%relu_1, 0), kwargs = {})
triton_poi_fused_add_mul_relu_threshold_backward_6 = async_compile.triton('triton_poi_fused_add_mul_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=[16], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*i1', 5: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_mul_relu_threshold_backward_6', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 3, '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_mul_relu_threshold_backward_6(in_ptr0, in_ptr1, in_ptr2, 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
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), xmask)
    tmp1 = tl.load(in_ptr1 + (x0), xmask)
    tmp3 = tl.load(in_ptr2 + (x0), xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tmp7 = 0.3333333333333333
    tmp8 = tmp6 * tmp7
    tmp9 = 0.0
    tmp10 = tmp6 <= tmp9
    tl.store(out_ptr0 + (x0), tmp8, xmask)
    tl.store(out_ptr1 + (x0), tmp10, 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, primals_15, primals_16, primals_17, primals_18, primals_19, primals_20, primals_21, primals_22, primals_23, primals_24 = args
    args.clear()
    assert_size_stride(primals_1, (4, 4), (4, 1))
    assert_size_stride(primals_2, (4, ), (1, ))
    assert_size_stride(primals_3, (4, 4), (4, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    assert_size_stride(primals_5, (4, 4), (4, 1))
    assert_size_stride(primals_6, (4, ), (1, ))
    assert_size_stride(primals_7, (4, 4), (4, 1))
    assert_size_stride(primals_8, (4, 4), (4, 1))
    assert_size_stride(primals_9, (4, ), (1, ))
    assert_size_stride(primals_10, (4, 4), (4, 1))
    assert_size_stride(primals_11, (4, 4), (4, 1))
    assert_size_stride(primals_12, (4, 4), (4, 1))
    assert_size_stride(primals_13, (4, ), (1, ))
    assert_size_stride(primals_14, (4, 4), (4, 1))
    assert_size_stride(primals_15, (4, 4), (4, 1))
    assert_size_stride(primals_16, (4, ), (1, ))
    assert_size_stride(primals_17, (4, 4), (4, 1))
    assert_size_stride(primals_18, (4, 4), (4, 1))
    assert_size_stride(primals_19, (4, ), (1, ))
    assert_size_stride(primals_20, (4, 4), (4, 1))
    assert_size_stride(primals_21, (4, 4), (4, 1))
    assert_size_stride(primals_22, (4, 4), (4, 1))
    assert_size_stride(primals_23, (4, ), (1, ))
    assert_size_stride(primals_24, (4, 4), (4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((20, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [stack], Original ATen: [aten.stack]
        stream0 = get_raw_stream(0)
        triton_poi_fused_stack_0.run(primals_3, primals_10, primals_20, buf0, 80, grid=grid(80), stream=stream0)
        del primals_20
        buf1 = empty_strided_cuda((20, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [stack_1], Original ATen: [aten.stack]
        triton_poi_fused_stack_1.run(primals_1, primals_8, primals_22, primals_18, primals_15, buf1, 80, grid=grid(80), stream=stream0)
        del primals_1
        del primals_15
        del primals_18
        del primals_22
        del primals_8
        buf2 = empty_strided_cuda((20, ), (1, ), torch.float32)
        # Topologically Sorted Source Nodes: [stack_2], Original ATen: [aten.stack]
        triton_poi_fused_stack_2.run(primals_2, primals_9, primals_23, primals_19, primals_16, buf2, 20, grid=grid(20), stream=stream0)
        del primals_16
        del primals_19
        del primals_2
        del primals_23
        del primals_9
        buf3 = empty_strided_cuda((5, 4, 4), (16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [baddbmm], Original ATen: [aten.baddbmm]
        extern_kernels.bmm(reinterpret_tensor(buf0, (5, 4, 4), (16, 4, 1), 0), reinterpret_tensor(buf1, (5, 4, 4), (16, 1, 4), 0), out=buf3)
        del buf1
        buf4 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [n2n_1], Original ATen: [aten.zeros]
        triton_poi_fused_zeros_3.run(buf4, 16, grid=grid(16), stream=stream0)
        buf5 = buf3; del buf3  # reuse
        # Topologically Sorted Source Nodes: [baddbmm], Original ATen: [aten.baddbmm]
        triton_poi_fused_baddbmm_4.run(buf5, buf2, 80, grid=grid(80), stream=stream0)
        del buf2
        # Topologically Sorted Source Nodes: [n2n_1], Original ATen: [aten._sparse_addmm]
        buf6 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 4), 0), reinterpret_tensor(primals_4, (4, 4), (1, 4), 0), beta=0)
        buf7 = buf6
        del buf6
        buf8 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [n2e], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_6, primals_3, reinterpret_tensor(primals_5, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf8)
        del primals_5
        del primals_6
        # Topologically Sorted Source Nodes: [n2e_1], Original ATen: [aten._sparse_addmm]
        buf9 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf8, (4, 4), (1, 4), 0), reinterpret_tensor(primals_7, (4, 4), (1, 4), 0), beta=0)
        buf10 = buf9
        del buf9
        # Topologically Sorted Source Nodes: [e2n_1], Original ATen: [aten._sparse_addmm]
        buf11 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 4), 16), reinterpret_tensor(primals_11, (4, 4), (1, 4), 0), beta=0)
        buf12 = buf11
        del buf11
        buf13 = buf8; del buf8  # reuse
        # Topologically Sorted Source Nodes: [e2e], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_13, primals_10, reinterpret_tensor(primals_12, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf13)
        del primals_12
        del primals_13
        # Topologically Sorted Source Nodes: [e2e_1], Original ATen: [aten._sparse_addmm]
        buf14 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf13, (4, 4), (1, 4), 0), reinterpret_tensor(primals_14, (4, 4), (1, 4), 0), beta=0)
        del buf13
        buf15 = buf14
        del buf14
        # Topologically Sorted Source Nodes: [e2t_1], Original ATen: [aten._sparse_addmm]
        buf16 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 4), 64), reinterpret_tensor(primals_17, (4, 4), (1, 4), 0), beta=0)
        buf17 = buf16
        del buf16
        # Topologically Sorted Source Nodes: [t2t_1], Original ATen: [aten._sparse_addmm]
        buf18 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 4), 48), reinterpret_tensor(primals_21, (4, 4), (1, 4), 0), beta=0)
        buf19 = buf18
        del buf18
        # Topologically Sorted Source Nodes: [t2e_1], Original ATen: [aten._sparse_addmm]
        buf20 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 4), 32), reinterpret_tensor(primals_24, (4, 4), (1, 4), 0), beta=0)
        del buf5
        buf21 = buf20
        del buf20
        buf22 = reinterpret_tensor(buf4, (4, 4), (1, 4), 0); del buf4  # reuse
        buf27 = empty_strided_cuda((4, 4), (1, 4), torch.bool)
        # Topologically Sorted Source Nodes: [add, relu, X0], Original ATen: [aten.add, aten.relu, aten.mul, aten.threshold_backward]
        triton_poi_fused_add_mul_relu_threshold_backward_5.run(buf7, buf12, buf22, buf27, 16, grid=grid(16), stream=stream0)
        del buf12
        buf23 = reinterpret_tensor(buf7, (4, 4), (1, 4), 0); del buf7  # reuse
        buf26 = empty_strided_cuda((4, 4), (1, 4), torch.bool)
        # Topologically Sorted Source Nodes: [add_1, add_2, relu_1, X1], Original ATen: [aten.add, aten.relu, aten.mul, aten.threshold_backward]
        triton_poi_fused_add_mul_relu_threshold_backward_6.run(buf15, buf10, buf21, buf23, buf26, 16, grid=grid(16), stream=stream0)
        del buf10
        del buf15
        buf24 = reinterpret_tensor(buf21, (4, 4), (1, 4), 0); del buf21  # reuse
        buf25 = empty_strided_cuda((4, 4), (1, 4), torch.bool)
        # Topologically Sorted Source Nodes: [add_3, relu_2, X2], Original ATen: [aten.add, aten.relu, aten.mul, aten.threshold_backward]
        triton_poi_fused_add_mul_relu_threshold_backward_5.run(buf19, buf17, buf24, buf25, 16, grid=grid(16), stream=stream0)
        del buf17
        del buf19
    return (buf22, buf23, buf24, primals_3, primals_10, buf25, buf26, buf27, primals_24, primals_21, primals_17, primals_14, primals_11, primals_7, primals_4, reinterpret_tensor(buf0, (5, 4, 4), (16, 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, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_3 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_10 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_11 = rand_strided((4, 4), (4, 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, ), device='cuda:0', dtype=torch.float32)
    primals_14 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_15 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_16 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_17 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_18 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_19 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_20 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_21 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_22 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_23 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_24 = rand_strided((4, 4), (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, primals_11, primals_12, primals_13, primals_14, primals_15, primals_16, primals_17, primals_18, primals_19, primals_20, primals_21, primals_22, primals_23, primals_24])
    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 SCConv_Layer(nn.Module):

    def __init__(self, num_node_feats, num_edge_feats, num_triangle_feats,
        output_size, bias=True, f=F.relu):
        super().__init__()
        self.n2n_weights = nn.Linear(num_node_feats, output_size, bias=bias)
        self.n2e_weights = nn.Linear(num_node_feats, output_size, bias=bias)
        self.e2e_weights = nn.Linear(num_edge_feats, output_size, bias=bias)
        self.e2n_weights = nn.Linear(num_edge_feats, output_size, bias=bias)
        self.e2t_weights = nn.Linear(num_edge_feats, output_size, bias=bias)
        self.t2e_weights = nn.Linear(num_triangle_feats, output_size, bias=bias
            )
        self.t2t_weights = nn.Linear(num_triangle_feats, output_size, bias=bias
            )
        self.w = f

    def forward(self, X0, X1, X2, L0, L1, L2, B2D3, D2B1TD1inv, D1invB1,
        B2TD2inv):
        n2n = self.n2n_weights(X0)
        n2n = torch.sparse.mm(L0, n2n)
        n2e = self.n2e_weights(X0)
        n2e = torch.sparse.mm(D2B1TD1inv, n2e)
        e2n = self.e2n_weights(X1)
        e2n = torch.sparse.mm(D1invB1, e2n)
        e2e = self.e2e_weights(X1)
        e2e = torch.sparse.mm(L1, e2e)
        e2t = self.e2t_weights(X1)
        e2t = torch.sparse.mm(B2TD2inv, e2t)
        t2t = self.t2t_weights(X2)
        t2t = torch.sparse.mm(L2, t2t)
        t2e = self.t2e_weights(X2)
        t2e = torch.sparse.mm(B2D3, t2e)
        X0 = 1 / 2.0 * self.w(n2n + e2n)
        X1 = 1 / 3.0 * self.w(e2e + n2e + t2e)
        X2 = 1 / 2.0 * self.w(t2t + e2t)
        return X0, X1, X2


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


def get_init_inputs():
    return [[], {'num_node_feats': 4, 'num_edge_feats': 4,
        'num_triangle_feats': 4, 'output_size': 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
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_stack_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 80
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 4
    x0 = xindex % 4
    x2 = 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), tmp4 & xmask, other=0.0)
    tmp6 = tmp0 >= tmp3
    tmp7 = tl.full([1], 8, tl.int64)
    tmp8 = tmp0 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tl.load(in_ptr1 + (x0 + 4 * (-4 + x1)), tmp9 & xmask, other=0.0)
    tmp11 = tmp0 >= tmp7
    tmp12 = tl.full([1], 12, tl.int64)
    tmp13 = tmp0 < tmp12
    tmp14 = tmp11 & tmp13
    tmp15 = tl.load(in_ptr2 + (x0 + 4 * (-8 + x1)), tmp14 & xmask, other=0.0)
    tmp16 = tmp0 >= tmp12
    tmp17 = tl.full([1], 16, tl.int64)
    tmp18 = tmp0 < tmp17
    tmp19 = tmp16 & tmp18
    tmp20 = tl.load(in_ptr2 + (x0 + 4 * (-12 + x1)), tmp19 & xmask, other=0.0)
    tmp21 = tmp0 >= tmp17
    tl.full([1], 20, tl.int64)
    tmp24 = tl.load(in_ptr1 + (x0 + 4 * (-16 + x1)), tmp21 & xmask, other=0.0)
    tmp25 = tl.where(tmp19, tmp20, tmp24)
    tmp26 = tl.where(tmp14, tmp15, tmp25)
    tmp27 = tl.where(tmp9, tmp10, tmp26)
    tmp28 = tl.where(tmp4, tmp5, tmp27)
    tl.store(out_ptr0 + x2, tmp28, xmask)


@triton.jit
def triton_poi_fused_stack_1(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 80
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 4
    x0 = xindex % 4
    x2 = 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), tmp4 & xmask, other=0.0)
    tmp6 = tmp0 >= tmp3
    tmp7 = tl.full([1], 8, tl.int64)
    tmp8 = tmp0 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tl.load(in_ptr1 + (x0 + 4 * (-4 + x1)), tmp9 & xmask, other=0.0)
    tmp11 = tmp0 >= tmp7
    tmp12 = tl.full([1], 12, tl.int64)
    tmp13 = tmp0 < tmp12
    tmp14 = tmp11 & tmp13
    tmp15 = tl.load(in_ptr2 + (x0 + 4 * (-8 + x1)), tmp14 & xmask, other=0.0)
    tmp16 = tmp0 >= tmp12
    tmp17 = tl.full([1], 16, tl.int64)
    tmp18 = tmp0 < tmp17
    tmp19 = tmp16 & tmp18
    tmp20 = tl.load(in_ptr3 + (x0 + 4 * (-12 + x1)), tmp19 & xmask, other=0.0)
    tmp21 = tmp0 >= tmp17
    tl.full([1], 20, tl.int64)
    tmp24 = tl.load(in_ptr4 + (x0 + 4 * (-16 + x1)), tmp21 & xmask, other=0.0)
    tmp25 = tl.where(tmp19, tmp20, tmp24)
    tmp26 = tl.where(tmp14, tmp15, tmp25)
    tmp27 = tl.where(tmp9, tmp10, tmp26)
    tmp28 = tl.where(tmp4, tmp5, tmp27)
    tl.store(out_ptr0 + x2, tmp28, xmask)


@triton.jit
def triton_poi_fused_stack_2(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 20
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + x0, tmp4 & xmask, eviction_policy='evict_last',
        other=0.0)
    tmp6 = tmp0 >= tmp3
    tmp7 = tl.full([1], 8, tl.int64)
    tmp8 = tmp0 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tl.load(in_ptr1 + (-4 + x0), tmp9 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp11 = tmp0 >= tmp7
    tmp12 = tl.full([1], 12, tl.int64)
    tmp13 = tmp0 < tmp12
    tmp14 = tmp11 & tmp13
    tmp15 = tl.load(in_ptr2 + (-8 + x0), tmp14 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp16 = tmp0 >= tmp12
    tmp17 = tl.full([1], 16, tl.int64)
    tmp18 = tmp0 < tmp17
    tmp19 = tmp16 & tmp18
    tmp20 = tl.load(in_ptr3 + (-12 + x0), tmp19 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp21 = tmp0 >= tmp17
    tl.full([1], 20, tl.int64)
    tmp24 = tl.load(in_ptr4 + (-16 + x0), tmp21 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp25 = tl.where(tmp19, tmp20, tmp24)
    tmp26 = tl.where(tmp14, tmp15, tmp25)
    tmp27 = tl.where(tmp9, tmp10, tmp26)
    tmp28 = tl.where(tmp4, tmp5, tmp27)
    tl.store(out_ptr0 + x0, tmp28, xmask)


@triton.jit
def triton_poi_fused_zeros_3(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 = 0.0
    tl.store(out_ptr0 + x0, tmp0, xmask)


@triton.jit
def triton_poi_fused_baddbmm_4(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 80
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 4
    x2 = xindex // 16
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 4 * x2), xmask, eviction_policy='evict_last'
        )
    tmp1 = tl.load(in_out_ptr0 + x3, xmask)
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x3, tmp2, xmask)


@triton.jit
def triton_poi_fused_add_mul_relu_threshold_backward_5(in_ptr0, in_ptr1,
    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
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask)
    tmp1 = tl.load(in_ptr1 + x0, xmask)
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.5
    tmp6 = tmp4 * tmp5
    tmp7 = 0.0
    tmp8 = tmp4 <= tmp7
    tl.store(out_ptr0 + x0, tmp6, xmask)
    tl.store(out_ptr1 + x0, tmp8, xmask)


@triton.jit
def triton_poi_fused_add_mul_relu_threshold_backward_6(in_ptr0, in_ptr1,
    in_ptr2, 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
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask)
    tmp1 = tl.load(in_ptr1 + x0, xmask)
    tmp3 = tl.load(in_ptr2 + x0, xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tmp7 = 0.3333333333333333
    tmp8 = tmp6 * tmp7
    tmp9 = 0.0
    tmp10 = tmp6 <= tmp9
    tl.store(out_ptr0 + x0, tmp8, xmask)
    tl.store(out_ptr1 + x0, tmp10, 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, primals_15, primals_16, primals_17,
        primals_18, primals_19, primals_20, primals_21, primals_22,
        primals_23, primals_24) = args
    args.clear()
    assert_size_stride(primals_1, (4, 4), (4, 1))
    assert_size_stride(primals_2, (4,), (1,))
    assert_size_stride(primals_3, (4, 4), (4, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    assert_size_stride(primals_5, (4, 4), (4, 1))
    assert_size_stride(primals_6, (4,), (1,))
    assert_size_stride(primals_7, (4, 4), (4, 1))
    assert_size_stride(primals_8, (4, 4), (4, 1))
    assert_size_stride(primals_9, (4,), (1,))
    assert_size_stride(primals_10, (4, 4), (4, 1))
    assert_size_stride(primals_11, (4, 4), (4, 1))
    assert_size_stride(primals_12, (4, 4), (4, 1))
    assert_size_stride(primals_13, (4,), (1,))
    assert_size_stride(primals_14, (4, 4), (4, 1))
    assert_size_stride(primals_15, (4, 4), (4, 1))
    assert_size_stride(primals_16, (4,), (1,))
    assert_size_stride(primals_17, (4, 4), (4, 1))
    assert_size_stride(primals_18, (4, 4), (4, 1))
    assert_size_stride(primals_19, (4,), (1,))
    assert_size_stride(primals_20, (4, 4), (4, 1))
    assert_size_stride(primals_21, (4, 4), (4, 1))
    assert_size_stride(primals_22, (4, 4), (4, 1))
    assert_size_stride(primals_23, (4,), (1,))
    assert_size_stride(primals_24, (4, 4), (4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((20, 4), (4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_stack_0[grid(80)](primals_3, primals_10,
            primals_20, buf0, 80, XBLOCK=128, num_warps=4, num_stages=1)
        del primals_20
        buf1 = empty_strided_cuda((20, 4), (4, 1), torch.float32)
        triton_poi_fused_stack_1[grid(80)](primals_1, primals_8, primals_22,
            primals_18, primals_15, buf1, 80, XBLOCK=128, num_warps=4,
            num_stages=1)
        del primals_1
        del primals_15
        del primals_18
        del primals_22
        del primals_8
        buf2 = empty_strided_cuda((20,), (1,), torch.float32)
        triton_poi_fused_stack_2[grid(20)](primals_2, primals_9, primals_23,
            primals_19, primals_16, buf2, 20, XBLOCK=32, num_warps=1,
            num_stages=1)
        del primals_16
        del primals_19
        del primals_2
        del primals_23
        del primals_9
        buf3 = empty_strided_cuda((5, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf0, (5, 4, 4), (16, 4, 1), 
            0), reinterpret_tensor(buf1, (5, 4, 4), (16, 1, 4), 0), out=buf3)
        del buf1
        buf4 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused_zeros_3[grid(16)](buf4, 16, XBLOCK=16, num_warps=1,
            num_stages=1)
        buf5 = buf3
        del buf3
        triton_poi_fused_baddbmm_4[grid(80)](buf5, buf2, 80, XBLOCK=128,
            num_warps=4, num_stages=1)
        del buf2
        buf6 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(buf4,
            (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 4), 0),
            reinterpret_tensor(primals_4, (4, 4), (1, 4), 0), beta=0)
        buf7 = buf6
        del buf6
        buf8 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.addmm(primals_6, primals_3, reinterpret_tensor(
            primals_5, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf8)
        del primals_5
        del primals_6
        buf9 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(buf4,
            (4, 4), (1, 4), 0), reinterpret_tensor(buf8, (4, 4), (1, 4), 0),
            reinterpret_tensor(primals_7, (4, 4), (1, 4), 0), beta=0)
        buf10 = buf9
        del buf9
        buf11 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(
            buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 
            4), 16), reinterpret_tensor(primals_11, (4, 4), (1, 4), 0), beta=0)
        buf12 = buf11
        del buf11
        buf13 = buf8
        del buf8
        extern_kernels.addmm(primals_13, primals_10, reinterpret_tensor(
            primals_12, (4, 4), (1, 4), 0), alpha=1, beta=1, out=buf13)
        del primals_12
        del primals_13
        buf14 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(
            buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf13, (4, 4), (1,
            4), 0), reinterpret_tensor(primals_14, (4, 4), (1, 4), 0), beta=0)
        del buf13
        buf15 = buf14
        del buf14
        buf16 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(
            buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 
            4), 64), reinterpret_tensor(primals_17, (4, 4), (1, 4), 0), beta=0)
        buf17 = buf16
        del buf16
        buf18 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(
            buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 
            4), 48), reinterpret_tensor(primals_21, (4, 4), (1, 4), 0), beta=0)
        buf19 = buf18
        del buf18
        buf20 = torch.ops.aten._sparse_addmm.default(reinterpret_tensor(
            buf4, (4, 4), (1, 4), 0), reinterpret_tensor(buf5, (4, 4), (1, 
            4), 32), reinterpret_tensor(primals_24, (4, 4), (1, 4), 0), beta=0)
        del buf5
        buf21 = buf20
        del buf20
        buf22 = reinterpret_tensor(buf4, (4, 4), (1, 4), 0)
        del buf4
        buf27 = empty_strided_cuda((4, 4), (1, 4), torch.bool)
        triton_poi_fused_add_mul_relu_threshold_backward_5[grid(16)](buf7,
            buf12, buf22, buf27, 16, XBLOCK=16, num_warps=1, num_stages=1)
        del buf12
        buf23 = reinterpret_tensor(buf7, (4, 4), (1, 4), 0)
        del buf7
        buf26 = empty_strided_cuda((4, 4), (1, 4), torch.bool)
        triton_poi_fused_add_mul_relu_threshold_backward_6[grid(16)](buf15,
            buf10, buf21, buf23, buf26, 16, XBLOCK=16, num_warps=1,
            num_stages=1)
        del buf10
        del buf15
        buf24 = reinterpret_tensor(buf21, (4, 4), (1, 4), 0)
        del buf21
        buf25 = empty_strided_cuda((4, 4), (1, 4), torch.bool)
        triton_poi_fused_add_mul_relu_threshold_backward_5[grid(16)](buf19,
            buf17, buf24, buf25, 16, XBLOCK=16, num_warps=1, num_stages=1)
        del buf17
        del buf19
    return (buf22, buf23, buf24, primals_3, primals_10, buf25, buf26, buf27,
        primals_24, primals_21, primals_17, primals_14, primals_11,
        primals_7, primals_4, reinterpret_tensor(buf0, (5, 4, 4), (16, 1, 4
        ), 0))


class SCConv_LayerNew(nn.Module):

    def __init__(self, num_node_feats, num_edge_feats, num_triangle_feats,
        output_size, bias=True, f=F.relu):
        super().__init__()
        self.n2n_weights = nn.Linear(num_node_feats, output_size, bias=bias)
        self.n2e_weights = nn.Linear(num_node_feats, output_size, bias=bias)
        self.e2e_weights = nn.Linear(num_edge_feats, output_size, bias=bias)
        self.e2n_weights = nn.Linear(num_edge_feats, output_size, bias=bias)
        self.e2t_weights = nn.Linear(num_edge_feats, output_size, bias=bias)
        self.t2e_weights = nn.Linear(num_triangle_feats, output_size, bias=bias
            )
        self.t2t_weights = nn.Linear(num_triangle_feats, output_size, bias=bias
            )
        self.w = f

    def forward(self, input_0, input_1, input_2, input_3, input_4, input_5,
        input_6, input_7, input_8, input_9):
        primals_1 = self.n2n_weights.weight
        primals_2 = self.n2n_weights.bias
        primals_3 = self.n2e_weights.weight
        primals_6 = self.n2e_weights.bias
        primals_4 = self.e2e_weights.weight
        primals_9 = self.e2e_weights.bias
        primals_5 = self.e2n_weights.weight
        primals_13 = self.e2n_weights.bias
        primals_7 = self.e2t_weights.weight
        primals_16 = self.e2t_weights.bias
        primals_8 = self.t2e_weights.weight
        primals_19 = self.t2e_weights.bias
        primals_10 = self.t2t_weights.weight
        primals_23 = self.t2t_weights.bias
        primals_11 = input_0
        primals_12 = input_1
        primals_14 = input_2
        primals_15 = input_3
        primals_17 = input_4
        primals_18 = input_5
        primals_20 = input_6
        primals_21 = input_7
        primals_22 = input_8
        primals_24 = input_9
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9,
            primals_10, primals_11, primals_12, primals_13, primals_14,
            primals_15, primals_16, primals_17, primals_18, primals_19,
            primals_20, primals_21, primals_22, primals_23, primals_24])
        return output[0], output[1], output[2]
