# 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/fw/cfwdcih2cjutimasiyyjmqtvcwielvevbyztxmcudgbineleb7y6.py
# Topologically Sorted Source Nodes: [clone], Original ATen: [aten.clone]
# Source node to ATen node mapping:
#   clone => clone
# Graph fragment:
#   %clone : [num_users=2] = call_function[target=torch.ops.aten.clone.default](args = (%select,), kwargs = {})
triton_poi_fused_clone_0 = async_compile.triton('triton_poi_fused_clone_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=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_clone_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_clone_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 64
    x1 = (xindex // 64)
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (128 + x0 + (256*x1)), xmask)
    tl.store(out_ptr0 + (x2), tmp0, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/32/c32v7egt4mupqssam3gmac2qgv3ujprjybthsgweflmot256qqw7.py
# Topologically Sorted Source Nodes: [emb_ref], Original ATen: [aten.convolution]
# Source node to ATen node mapping:
#   emb_ref => convolution
# Graph fragment:
#   %convolution : [num_users=5] = call_function[target=torch.ops.aten.convolution.default](args = (%clone, %primals_2, %primals_3, [1, 1], [1, 1], [1, 1], False, [0, 0], 1), kwargs = {})
triton_poi_fused_convolution_1 = async_compile.triton('triton_poi_fused_convolution_1', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

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

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


# kernel path: runs/run_shard_4/inductor_cache/dd/cddvsrfyxw75ijst5cin6aohrrtik7ynlsfvwyeaaiu3zp5wxrvy.py
# Topologically Sorted Source Nodes: [conv2d_1], Original ATen: [aten.convolution]
# Source node to ATen node mapping:
#   conv2d_1 => convolution_1
# Graph fragment:
#   %convolution_1 : [num_users=2] = call_function[target=torch.ops.aten.convolution.default](args = (%view, %primals_4, %primals_5, [1, 1], [1, 1], [1, 1], False, [0, 0], 1), kwargs = {})
triton_poi_fused_convolution_2 = async_compile.triton('triton_poi_fused_convolution_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=[1024], 
    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_convolution_2', '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_convolution_2(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = (xindex // 16) % 4
    tmp0 = tl.load(in_out_ptr0 + (x3), xmask)
    tmp1 = tl.load(in_ptr0 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + (x3), tmp2, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/jy/cjyh2vwgujkfsf2kcs7hh3cdu3qkm44553unxmedjkwz6ka4mjss.py
# Topologically Sorted Source Nodes: [cat], Original ATen: [aten.cat]
# Source node to ATen node mapping:
#   cat => cat
# Graph fragment:
#   %cat : [num_users=2] = call_function[target=torch.ops.aten.cat.default](args = ([%sum_1, %sum_2, %sum_3, %sum_4], 1), kwargs = {})
triton_poi_fused_cat_3 = async_compile.triton('triton_poi_fused_cat_3', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

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

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*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_cat_3', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 32, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_cat_3(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = (xindex // 16) % 4
    x0 = xindex % 16
    x2 = (xindex // 64)
    x3 = xindex
    tmp0 = x1
    tmp1 = tl.full([1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x0 + (256*x2)), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp6 = tl.load(in_ptr1 + (x0 + (64*x2)), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp7 = tmp5 * tmp6
    tmp8 = tl.load(in_ptr0 + (16 + x0 + (256*x2)), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp9 = tl.load(in_ptr1 + (16 + x0 + (64*x2)), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp10 = tmp8 * tmp9
    tmp11 = tmp7 + tmp10
    tmp12 = tl.load(in_ptr0 + (32 + x0 + (256*x2)), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp13 = tl.load(in_ptr1 + (32 + x0 + (64*x2)), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp14 = tmp12 * tmp13
    tmp15 = tmp11 + tmp14
    tmp16 = tl.load(in_ptr0 + (48 + x0 + (256*x2)), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp17 = tl.load(in_ptr1 + (48 + x0 + (64*x2)), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp18 = tmp16 * tmp17
    tmp19 = tmp15 + tmp18
    tmp20 = tl.full(tmp19.shape, 0.0, tmp19.dtype)
    tmp21 = tl.where(tmp4, tmp19, tmp20)
    tmp22 = tmp0 >= tmp3
    tmp23 = tl.full([1], 2, tl.int64)
    tmp24 = tmp0 < tmp23
    tmp25 = tmp22 & tmp24
    tmp26 = tl.load(in_ptr0 + (64 + x0 + (256*x2)), tmp25 & xmask, eviction_policy='evict_last', other=0.0)
    tmp27 = tl.load(in_ptr1 + (x0 + (64*x2)), tmp25 & xmask, eviction_policy='evict_last', other=0.0)
    tmp28 = tmp26 * tmp27
    tmp29 = tl.load(in_ptr0 + (80 + x0 + (256*x2)), tmp25 & xmask, eviction_policy='evict_last', other=0.0)
    tmp30 = tl.load(in_ptr1 + (16 + x0 + (64*x2)), tmp25 & xmask, eviction_policy='evict_last', other=0.0)
    tmp31 = tmp29 * tmp30
    tmp32 = tmp28 + tmp31
    tmp33 = tl.load(in_ptr0 + (96 + x0 + (256*x2)), tmp25 & xmask, eviction_policy='evict_last', other=0.0)
    tmp34 = tl.load(in_ptr1 + (32 + x0 + (64*x2)), tmp25 & xmask, eviction_policy='evict_last', other=0.0)
    tmp35 = tmp33 * tmp34
    tmp36 = tmp32 + tmp35
    tmp37 = tl.load(in_ptr0 + (112 + x0 + (256*x2)), tmp25 & xmask, eviction_policy='evict_last', other=0.0)
    tmp38 = tl.load(in_ptr1 + (48 + x0 + (64*x2)), tmp25 & xmask, eviction_policy='evict_last', other=0.0)
    tmp39 = tmp37 * tmp38
    tmp40 = tmp36 + tmp39
    tmp41 = tl.full(tmp40.shape, 0.0, tmp40.dtype)
    tmp42 = tl.where(tmp25, tmp40, tmp41)
    tmp43 = tmp0 >= tmp23
    tmp44 = tl.full([1], 3, tl.int64)
    tmp45 = tmp0 < tmp44
    tmp46 = tmp43 & tmp45
    tmp47 = tl.load(in_ptr0 + (128 + x0 + (256*x2)), tmp46 & xmask, eviction_policy='evict_last', other=0.0)
    tmp48 = tl.load(in_ptr1 + (x0 + (64*x2)), tmp46 & xmask, eviction_policy='evict_last', other=0.0)
    tmp49 = tmp47 * tmp48
    tmp50 = tl.load(in_ptr0 + (144 + x0 + (256*x2)), tmp46 & xmask, eviction_policy='evict_last', other=0.0)
    tmp51 = tl.load(in_ptr1 + (16 + x0 + (64*x2)), tmp46 & xmask, eviction_policy='evict_last', other=0.0)
    tmp52 = tmp50 * tmp51
    tmp53 = tmp49 + tmp52
    tmp54 = tl.load(in_ptr0 + (160 + x0 + (256*x2)), tmp46 & xmask, eviction_policy='evict_last', other=0.0)
    tmp55 = tl.load(in_ptr1 + (32 + x0 + (64*x2)), tmp46 & xmask, eviction_policy='evict_last', other=0.0)
    tmp56 = tmp54 * tmp55
    tmp57 = tmp53 + tmp56
    tmp58 = tl.load(in_ptr0 + (176 + x0 + (256*x2)), tmp46 & xmask, eviction_policy='evict_last', other=0.0)
    tmp59 = tl.load(in_ptr1 + (48 + x0 + (64*x2)), tmp46 & xmask, eviction_policy='evict_last', other=0.0)
    tmp60 = tmp58 * tmp59
    tmp61 = tmp57 + tmp60
    tmp62 = tl.full(tmp61.shape, 0.0, tmp61.dtype)
    tmp63 = tl.where(tmp46, tmp61, tmp62)
    tmp64 = tmp0 >= tmp44
    tmp65 = tl.full([1], 4, tl.int64)
    tmp66 = tmp0 < tmp65
    tmp67 = tl.load(in_ptr0 + (192 + x0 + (256*x2)), tmp64 & xmask, eviction_policy='evict_last', other=0.0)
    tmp68 = tl.load(in_ptr1 + (x0 + (64*x2)), tmp64 & xmask, eviction_policy='evict_last', other=0.0)
    tmp69 = tmp67 * tmp68
    tmp70 = tl.load(in_ptr0 + (208 + x0 + (256*x2)), tmp64 & xmask, eviction_policy='evict_last', other=0.0)
    tmp71 = tl.load(in_ptr1 + (16 + x0 + (64*x2)), tmp64 & xmask, eviction_policy='evict_last', other=0.0)
    tmp72 = tmp70 * tmp71
    tmp73 = tmp69 + tmp72
    tmp74 = tl.load(in_ptr0 + (224 + x0 + (256*x2)), tmp64 & xmask, eviction_policy='evict_last', other=0.0)
    tmp75 = tl.load(in_ptr1 + (32 + x0 + (64*x2)), tmp64 & xmask, eviction_policy='evict_last', other=0.0)
    tmp76 = tmp74 * tmp75
    tmp77 = tmp73 + tmp76
    tmp78 = tl.load(in_ptr0 + (240 + x0 + (256*x2)), tmp64 & xmask, eviction_policy='evict_last', other=0.0)
    tmp79 = tl.load(in_ptr1 + (48 + x0 + (64*x2)), tmp64 & xmask, eviction_policy='evict_last', other=0.0)
    tmp80 = tmp78 * tmp79
    tmp81 = tmp77 + tmp80
    tmp82 = tl.full(tmp81.shape, 0.0, tmp81.dtype)
    tmp83 = tl.where(tmp64, tmp81, tmp82)
    tmp84 = tl.where(tmp46, tmp63, tmp83)
    tmp85 = tl.where(tmp25, tmp42, tmp84)
    tmp86 = tl.where(tmp4, tmp21, tmp85)
    tl.store(out_ptr0 + (x3), tmp86, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/cz/cczkvjxkaxd76w3ehl7ot7wat4wpdvnr2w6ay7zzw3thvmqfdhmp.py
# Topologically Sorted Source Nodes: [aggr_fea], Original ATen: [aten.mul]
# Source node to ATen node mapping:
#   aggr_fea => mul_4
# Graph fragment:
#   %mul_4 : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%view_3, %view_2), kwargs = {})
triton_poi_fused_mul_4 = async_compile.triton('triton_poi_fused_mul_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=[1024], 
    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_mul_4', '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_mul_4(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x0 = xindex % 16
    x1 = (xindex // 16) % 16
    x2 = (xindex // 256)
    tmp0 = tl.load(in_ptr0 + (x3), xmask)
    tmp1 = tl.load(in_ptr1 + (x0 + (16*(x1 // 4)) + (64*x2)), xmask)
    tmp2 = tl.sigmoid(tmp1)
    tmp3 = tmp0 * tmp2
    tl.store(out_ptr0 + (x3), tmp3, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/xc/cxcgkv6dn565tstnto26lhembvldydbo44vr3jduccj7zlo42i3h.py
# Topologically Sorted Source Nodes: [conv2d_2, fea, out], Original ATen: [aten.convolution, aten.leaky_relu, aten.pixel_shuffle, aten.leaky_relu_backward]
# Source node to ATen node mapping:
#   conv2d_2 => convolution_2
#   fea => gt, mul_5, where
#   out => clone_1
# Graph fragment:
#   %convolution_2 : [num_users=3] = call_function[target=torch.ops.aten.convolution.default](args = (%mul_4, %primals_6, %primals_7, [1, 1], [0, 0], [1, 1], False, [0, 0], 1), kwargs = {})
#   %gt : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%convolution_2, 0), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%convolution_2, 0.1), kwargs = {})
#   %where : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt, %convolution_2, %mul_5), kwargs = {})
#   %clone_1 : [num_users=1] = call_function[target=torch.ops.aten.clone.default](args = (%permute,), kwargs = {memory_format: torch.contiguous_format})
#   %gt_1 : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%where, 0), kwargs = {})
triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_pixel_shuffle_5 = async_compile.triton('triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_pixel_shuffle_5', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

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

@triton_heuristics.pointwise(
    size_hints=[64, 16], tile_hint=TileHint.DEFAULT,
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*i1', 4: 'i32', 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_convolution_leaky_relu_leaky_relu_backward_pixel_shuffle_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_convolution_leaky_relu_leaky_relu_backward_pixel_shuffle_5(in_ptr0, in_ptr1, out_ptr0, out_ptr1, ynumel, xnumel, YBLOCK : tl.constexpr, XBLOCK : tl.constexpr):
    ynumel = 64
    xnumel = 16
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x7 = xindex
    y8 = yindex
    y6 = yindex % 16
    x4 = xindex % 4
    x5 = (xindex // 4)
    y0 = yindex % 2
    y1 = (yindex // 2) % 2
    y9 = (yindex // 4)
    tmp0 = tl.load(in_ptr0 + (x7 + (16*y8)), xmask & ymask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + (y6), ymask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.1
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = tmp7 > tmp3
    tl.store(out_ptr0 + (y0 + (2*x4) + (8*y1) + (16*x5) + (64*y9)), tmp7, xmask & ymask)
    tl.store(out_ptr1 + (x7 + (16*y8)), tmp8, xmask & ymask)
''', 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 = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4, 4, 4), (256, 64, 16, 4, 1))
    assert_size_stride(primals_2, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_3, (4, ), (1, ))
    assert_size_stride(primals_4, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_5, (4, ), (1, ))
    assert_size_stride(primals_6, (16, 16, 1, 1), (16, 1, 1, 1))
    assert_size_stride(primals_7, (16, ), (1, ))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [clone], Original ATen: [aten.clone]
        stream0 = get_raw_stream(0)
        triton_poi_fused_clone_0.run(primals_1, buf0, 256, grid=grid(256), stream=stream0)
        # Topologically Sorted Source Nodes: [emb_ref], Original ATen: [aten.convolution]
        buf1 = extern_kernels.convolution(buf0, primals_2, stride=(1, 1), padding=(1, 1), dilation=(1, 1), transposed=False, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf1, (4, 4, 4, 4), (64, 16, 4, 1))
        buf2 = buf1; del buf1  # reuse
        # Topologically Sorted Source Nodes: [emb_ref], Original ATen: [aten.convolution]
        triton_poi_fused_convolution_1.run(buf2, primals_3, 256, grid=grid(256), stream=stream0)
        del primals_3
        # Topologically Sorted Source Nodes: [conv2d_1], Original ATen: [aten.convolution]
        buf3 = extern_kernels.convolution(reinterpret_tensor(primals_1, (16, 4, 4, 4), (64, 16, 4, 1), 0), primals_4, stride=(1, 1), padding=(1, 1), dilation=(1, 1), transposed=False, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf3, (16, 4, 4, 4), (64, 16, 4, 1))
        buf4 = buf3; del buf3  # reuse
        # Topologically Sorted Source Nodes: [conv2d_1], Original ATen: [aten.convolution]
        triton_poi_fused_convolution_2.run(buf4, primals_5, 1024, grid=grid(1024), stream=stream0)
        del primals_5
        buf5 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [cat], Original ATen: [aten.cat]
        triton_poi_fused_cat_3.run(buf4, buf2, buf5, 256, grid=grid(256), stream=stream0)
        buf6 = empty_strided_cuda((4, 16, 4, 4), (256, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [aggr_fea], Original ATen: [aten.mul]
        triton_poi_fused_mul_4.run(primals_1, buf5, buf6, 1024, grid=grid(1024), stream=stream0)
        # Topologically Sorted Source Nodes: [conv2d_2], Original ATen: [aten.convolution]
        buf7 = extern_kernels.convolution(buf6, primals_6, stride=(1, 1), padding=(0, 0), dilation=(1, 1), transposed=False, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf7, (4, 16, 4, 4), (256, 16, 4, 1))
        buf8 = empty_strided_cuda((4, 4, 4, 2, 4, 2), (256, 64, 16, 8, 2, 1), torch.float32)
        buf9 = empty_strided_cuda((4, 16, 4, 4), (256, 16, 4, 1), torch.bool)
        # Topologically Sorted Source Nodes: [conv2d_2, fea, out], Original ATen: [aten.convolution, aten.leaky_relu, aten.pixel_shuffle, aten.leaky_relu_backward]
        triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_pixel_shuffle_5.run(buf7, primals_7, buf8, buf9, 64, 16, grid=grid(64, 16), stream=stream0)
        del buf7
        del primals_7
    return (reinterpret_tensor(buf8, (4, 4, 8, 8), (256, 64, 8, 1), 0), primals_1, primals_2, primals_4, primals_6, buf0, buf2, buf4, buf5, buf6, buf9, )


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, 4, 4), (256, 64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_2 = rand_strided((4, 4, 3, 3), (36, 9, 3, 1), device='cuda:0', dtype=torch.float32)
    primals_3 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((4, 4, 3, 3), (36, 9, 3, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((16, 16, 1, 1), (16, 1, 1, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((16, ), (1, ), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([primals_1, primals_2, primals_3, primals_4, primals_5, primals_6, primals_7])
    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


class TemporalFusion(nn.Module):

    def __init__(self, nf, n_frame):
        super(TemporalFusion, self).__init__()
        self.n_frame = n_frame
        self.ref_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True)
        self.nbr_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True)
        self.up_conv = nn.Conv2d(nf * n_frame, nf * 4, 1, 1, bias=True)
        self.ps = nn.PixelShuffle(2)
        self.lrelu = nn.LeakyReLU(negative_slope=0.1, inplace=True)

    def forward(self, x):
        B, N, C, H, W = x.size()
        emb_ref = self.ref_conv(x[:, N // 2, :, :, :].clone())
        emb = self.nbr_conv(x.view(-1, C, H, W)).view(B, N, C, H, W)
        cor_l = []
        for i in range(N):
            cor = torch.sum(emb[:, i, :, :, :] * emb_ref, dim=1, keepdim=True)
            cor_l.append(cor)
        cor_prob = torch.sigmoid(torch.cat(cor_l, dim=1))
        cor_prob = cor_prob.unsqueeze(2).repeat(1, 1, C, 1, 1).view(B, -1, H, W
            )
        aggr_fea = x.view(B, -1, H, W) * cor_prob
        fea = self.lrelu(self.up_conv(aggr_fea))
        out = self.ps(fea)
        return out


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


def get_init_inputs():
    return [[], {'nf': 4, 'n_frame': 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


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


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


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


@triton.jit
def triton_poi_fused_cat_3(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 16 % 4
    x0 = xindex % 16
    x2 = xindex // 64
    x3 = xindex
    tmp0 = x1
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x0 + 256 * x2), tmp4 & xmask, eviction_policy
        ='evict_last', other=0.0)
    tmp6 = tl.load(in_ptr1 + (x0 + 64 * x2), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp7 = tmp5 * tmp6
    tmp8 = tl.load(in_ptr0 + (16 + x0 + 256 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp9 = tl.load(in_ptr1 + (16 + x0 + 64 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp10 = tmp8 * tmp9
    tmp11 = tmp7 + tmp10
    tmp12 = tl.load(in_ptr0 + (32 + x0 + 256 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp13 = tl.load(in_ptr1 + (32 + x0 + 64 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp14 = tmp12 * tmp13
    tmp15 = tmp11 + tmp14
    tmp16 = tl.load(in_ptr0 + (48 + x0 + 256 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp17 = tl.load(in_ptr1 + (48 + x0 + 64 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp18 = tmp16 * tmp17
    tmp19 = tmp15 + tmp18
    tmp20 = tl.full(tmp19.shape, 0.0, tmp19.dtype)
    tmp21 = tl.where(tmp4, tmp19, tmp20)
    tmp22 = tmp0 >= tmp3
    tmp23 = tl.full([1], 2, tl.int64)
    tmp24 = tmp0 < tmp23
    tmp25 = tmp22 & tmp24
    tmp26 = tl.load(in_ptr0 + (64 + x0 + 256 * x2), tmp25 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp27 = tl.load(in_ptr1 + (x0 + 64 * x2), tmp25 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp28 = tmp26 * tmp27
    tmp29 = tl.load(in_ptr0 + (80 + x0 + 256 * x2), tmp25 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp30 = tl.load(in_ptr1 + (16 + x0 + 64 * x2), tmp25 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp31 = tmp29 * tmp30
    tmp32 = tmp28 + tmp31
    tmp33 = tl.load(in_ptr0 + (96 + x0 + 256 * x2), tmp25 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp34 = tl.load(in_ptr1 + (32 + x0 + 64 * x2), tmp25 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp35 = tmp33 * tmp34
    tmp36 = tmp32 + tmp35
    tmp37 = tl.load(in_ptr0 + (112 + x0 + 256 * x2), tmp25 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp38 = tl.load(in_ptr1 + (48 + x0 + 64 * x2), tmp25 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp39 = tmp37 * tmp38
    tmp40 = tmp36 + tmp39
    tmp41 = tl.full(tmp40.shape, 0.0, tmp40.dtype)
    tmp42 = tl.where(tmp25, tmp40, tmp41)
    tmp43 = tmp0 >= tmp23
    tmp44 = tl.full([1], 3, tl.int64)
    tmp45 = tmp0 < tmp44
    tmp46 = tmp43 & tmp45
    tmp47 = tl.load(in_ptr0 + (128 + x0 + 256 * x2), tmp46 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp48 = tl.load(in_ptr1 + (x0 + 64 * x2), tmp46 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp49 = tmp47 * tmp48
    tmp50 = tl.load(in_ptr0 + (144 + x0 + 256 * x2), tmp46 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp51 = tl.load(in_ptr1 + (16 + x0 + 64 * x2), tmp46 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp52 = tmp50 * tmp51
    tmp53 = tmp49 + tmp52
    tmp54 = tl.load(in_ptr0 + (160 + x0 + 256 * x2), tmp46 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp55 = tl.load(in_ptr1 + (32 + x0 + 64 * x2), tmp46 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp56 = tmp54 * tmp55
    tmp57 = tmp53 + tmp56
    tmp58 = tl.load(in_ptr0 + (176 + x0 + 256 * x2), tmp46 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp59 = tl.load(in_ptr1 + (48 + x0 + 64 * x2), tmp46 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp60 = tmp58 * tmp59
    tmp61 = tmp57 + tmp60
    tmp62 = tl.full(tmp61.shape, 0.0, tmp61.dtype)
    tmp63 = tl.where(tmp46, tmp61, tmp62)
    tmp64 = tmp0 >= tmp44
    tl.full([1], 4, tl.int64)
    tmp67 = tl.load(in_ptr0 + (192 + x0 + 256 * x2), tmp64 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp68 = tl.load(in_ptr1 + (x0 + 64 * x2), tmp64 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp69 = tmp67 * tmp68
    tmp70 = tl.load(in_ptr0 + (208 + x0 + 256 * x2), tmp64 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp71 = tl.load(in_ptr1 + (16 + x0 + 64 * x2), tmp64 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp72 = tmp70 * tmp71
    tmp73 = tmp69 + tmp72
    tmp74 = tl.load(in_ptr0 + (224 + x0 + 256 * x2), tmp64 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp75 = tl.load(in_ptr1 + (32 + x0 + 64 * x2), tmp64 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp76 = tmp74 * tmp75
    tmp77 = tmp73 + tmp76
    tmp78 = tl.load(in_ptr0 + (240 + x0 + 256 * x2), tmp64 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp79 = tl.load(in_ptr1 + (48 + x0 + 64 * x2), tmp64 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp80 = tmp78 * tmp79
    tmp81 = tmp77 + tmp80
    tmp82 = tl.full(tmp81.shape, 0.0, tmp81.dtype)
    tmp83 = tl.where(tmp64, tmp81, tmp82)
    tmp84 = tl.where(tmp46, tmp63, tmp83)
    tmp85 = tl.where(tmp25, tmp42, tmp84)
    tmp86 = tl.where(tmp4, tmp21, tmp85)
    tl.store(out_ptr0 + x3, tmp86, xmask)


@triton.jit
def triton_poi_fused_mul_4(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x0 = xindex % 16
    x1 = xindex // 16 % 16
    x2 = xindex // 256
    tmp0 = tl.load(in_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr1 + (x0 + 16 * (x1 // 4) + 64 * x2), xmask)
    tmp2 = tl.sigmoid(tmp1)
    tmp3 = tmp0 * tmp2
    tl.store(out_ptr0 + x3, tmp3, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_pixel_shuffle_5(
    in_ptr0, in_ptr1, out_ptr0, out_ptr1, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    ynumel = 64
    xnumel = 16
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x7 = xindex
    y8 = yindex
    y6 = yindex % 16
    x4 = xindex % 4
    x5 = xindex // 4
    y0 = yindex % 2
    y1 = yindex // 2 % 2
    y9 = yindex // 4
    tmp0 = tl.load(in_ptr0 + (x7 + 16 * y8), xmask & ymask, eviction_policy
        ='evict_last')
    tmp1 = tl.load(in_ptr1 + y6, ymask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.1
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = tmp7 > tmp3
    tl.store(out_ptr0 + (y0 + 2 * x4 + 8 * y1 + 16 * x5 + 64 * y9), tmp7, 
        xmask & ymask)
    tl.store(out_ptr1 + (x7 + 16 * y8), tmp8, xmask & ymask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7) = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4, 4, 4), (256, 64, 16, 4, 1))
    assert_size_stride(primals_2, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_3, (4,), (1,))
    assert_size_stride(primals_4, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_5, (4,), (1,))
    assert_size_stride(primals_6, (16, 16, 1, 1), (16, 1, 1, 1))
    assert_size_stride(primals_7, (16,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_clone_0[grid(256)](primals_1, buf0, 256, XBLOCK=
            128, num_warps=4, num_stages=1)
        buf1 = extern_kernels.convolution(buf0, primals_2, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf1, (4, 4, 4, 4), (64, 16, 4, 1))
        buf2 = buf1
        del buf1
        triton_poi_fused_convolution_1[grid(256)](buf2, primals_3, 256,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_3
        buf3 = extern_kernels.convolution(reinterpret_tensor(primals_1, (16,
            4, 4, 4), (64, 16, 4, 1), 0), primals_4, stride=(1, 1), padding
            =(1, 1), dilation=(1, 1), transposed=False, output_padding=(0, 
            0), groups=1, bias=None)
        assert_size_stride(buf3, (16, 4, 4, 4), (64, 16, 4, 1))
        buf4 = buf3
        del buf3
        triton_poi_fused_convolution_2[grid(1024)](buf4, primals_5, 1024,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_5
        buf5 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_cat_3[grid(256)](buf4, buf2, buf5, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf6 = empty_strided_cuda((4, 16, 4, 4), (256, 16, 4, 1), torch.float32
            )
        triton_poi_fused_mul_4[grid(1024)](primals_1, buf5, buf6, 1024,
            XBLOCK=256, num_warps=4, num_stages=1)
        buf7 = extern_kernels.convolution(buf6, primals_6, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf7, (4, 16, 4, 4), (256, 16, 4, 1))
        buf8 = empty_strided_cuda((4, 4, 4, 2, 4, 2), (256, 64, 16, 8, 2, 1
            ), torch.float32)
        buf9 = empty_strided_cuda((4, 16, 4, 4), (256, 16, 4, 1), torch.bool)
        triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_pixel_shuffle_5[
            grid(64, 16)](buf7, primals_7, buf8, buf9, 64, 16, XBLOCK=16,
            YBLOCK=32, num_warps=4, num_stages=1)
        del buf7
        del primals_7
    return (reinterpret_tensor(buf8, (4, 4, 8, 8), (256, 64, 8, 1), 0),
        primals_1, primals_2, primals_4, primals_6, buf0, buf2, buf4, buf5,
        buf6, buf9)


class TemporalFusionNew(nn.Module):

    def __init__(self, nf, n_frame):
        super(TemporalFusionNew, self).__init__()
        self.n_frame = n_frame
        self.ref_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True)
        self.nbr_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True)
        self.up_conv = nn.Conv2d(nf * n_frame, nf * 4, 1, 1, bias=True)
        self.ps = nn.PixelShuffle(2)
        self.lrelu = nn.LeakyReLU(negative_slope=0.1, inplace=True)

    def forward(self, input_0):
        primals_2 = self.ref_conv.weight
        primals_3 = self.ref_conv.bias
        primals_4 = self.nbr_conv.weight
        primals_5 = self.nbr_conv.bias
        primals_6 = self.up_conv.weight
        primals_7 = self.up_conv.bias
        primals_1 = input_0
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7])
        return output[0]
