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.utils.data
from torch.utils import data as data
import torch.nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
from torch import autograd as autograd
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):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex % 1024
    x1 = xindex // 1024
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (2048 + x0 + 5120 * x1), None)
    tl.store(out_ptr0 + x2, tmp0, None)


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


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


@triton.jit
def triton_per_fused_cat_mul_sum_3(in_ptr0, in_ptr1, out_ptr5, out_ptr6,
    out_ptr7, out_ptr8, out_ptr9, xnumel, rnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    RBLOCK: tl.constexpr = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r2 = rindex
    x0 = xindex % 16
    x1 = xindex // 16
    tmp0 = tl.load(in_ptr0 + (x0 + 16 * r2 + 5120 * x1), xmask, other=0.0)
    tmp1 = tl.load(in_ptr1 + (x0 + 16 * r2 + 1024 * x1), xmask, other=0.0)
    tmp7 = tl.load(in_ptr0 + (1024 + x0 + 16 * r2 + 5120 * x1), xmask,
        other=0.0)
    tmp13 = tl.load(in_ptr0 + (2048 + x0 + 16 * r2 + 5120 * x1), xmask,
        other=0.0)
    tmp19 = tl.load(in_ptr0 + (3072 + x0 + 16 * r2 + 5120 * x1), xmask,
        other=0.0)
    tmp25 = tl.load(in_ptr0 + (4096 + x0 + 16 * r2 + 5120 * x1), xmask,
        other=0.0)
    tmp2 = tmp0 * tmp1
    tmp3 = tl.broadcast_to(tmp2, [XBLOCK, RBLOCK])
    tmp5 = tl.where(xmask, tmp3, 0)
    tmp6 = tl.sum(tmp5, 1)[:, None]
    tmp8 = tmp7 * tmp1
    tmp9 = tl.broadcast_to(tmp8, [XBLOCK, RBLOCK])
    tmp11 = tl.where(xmask, tmp9, 0)
    tmp12 = tl.sum(tmp11, 1)[:, None]
    tmp14 = tmp13 * tmp1
    tmp15 = tl.broadcast_to(tmp14, [XBLOCK, RBLOCK])
    tmp17 = tl.where(xmask, tmp15, 0)
    tmp18 = tl.sum(tmp17, 1)[:, None]
    tmp20 = tmp19 * tmp1
    tmp21 = tl.broadcast_to(tmp20, [XBLOCK, RBLOCK])
    tmp23 = tl.where(xmask, tmp21, 0)
    tmp24 = tl.sum(tmp23, 1)[:, None]
    tmp26 = tmp25 * tmp1
    tmp27 = tl.broadcast_to(tmp26, [XBLOCK, RBLOCK])
    tmp29 = tl.where(xmask, tmp27, 0)
    tmp30 = tl.sum(tmp29, 1)[:, None]
    tl.store(out_ptr5 + (x0 + 80 * x1), tmp6, xmask)
    tl.store(out_ptr6 + (x0 + 80 * x1), tmp12, xmask)
    tl.store(out_ptr7 + (x0 + 80 * x1), tmp18, xmask)
    tl.store(out_ptr8 + (x0 + 80 * x1), tmp24, xmask)
    tl.store(out_ptr9 + (x0 + 80 * x1), tmp30, xmask)


@triton.jit
def triton_poi_fused_mul_4(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x0 = xindex % 16
    x1 = xindex // 16 % 320
    x2 = xindex // 5120
    tmp0 = tl.load(in_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr1 + (x0 + 16 * (x1 // 64) + 80 * x2), None)
    tmp2 = tl.sigmoid(tmp1)
    tmp3 = tmp0 * tmp2
    tl.store(out_ptr0 + x3, tmp3, None)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_5(in_out_ptr0, in_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 16 % 64
    tmp0 = tl.load(in_out_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr0 + x1, None, 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)
    tl.store(in_out_ptr0 + x3, tmp7, None)


@triton.jit
def triton_poi_fused_avg_pool2d_max_pool2d_with_indices_6(in_ptr0, out_ptr0,
    out_ptr1, out_ptr2, xnumel, XBLOCK: tl.constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 2 % 2
    x0 = xindex % 2
    x5 = xindex // 2
    x3 = xindex // 256
    x6 = xindex % 256
    x7 = xindex
    tmp0 = -1 + 2 * x1
    tmp1 = tl.full([1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tmp2 & tmp4
    tmp6 = -1 + 2 * x0
    tmp7 = tmp6 >= tmp1
    tmp8 = tmp6 < tmp3
    tmp9 = tmp7 & tmp8
    tmp10 = tmp5 & tmp9
    tmp11 = tl.load(in_ptr0 + (-5 + 2 * x0 + 8 * x5), tmp10 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp12 = 2 * x0
    tmp13 = tmp12 >= tmp1
    tmp14 = tmp12 < tmp3
    tmp15 = tmp13 & tmp14
    tmp16 = tmp5 & tmp15
    tmp17 = tl.load(in_ptr0 + (-4 + 2 * x0 + 8 * x5), tmp16 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp18 = triton_helpers.maximum(tmp17, tmp11)
    tmp19 = 1 + 2 * x0
    tmp20 = tmp19 >= tmp1
    tmp21 = tmp19 < tmp3
    tmp22 = tmp20 & tmp21
    tmp23 = tmp5 & tmp22
    tmp24 = tl.load(in_ptr0 + (-3 + 2 * x0 + 8 * x5), tmp23 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp25 = triton_helpers.maximum(tmp24, tmp18)
    tmp26 = 2 * x1
    tmp27 = tmp26 >= tmp1
    tmp28 = tmp26 < tmp3
    tmp29 = tmp27 & tmp28
    tmp30 = tmp29 & tmp9
    tmp31 = tl.load(in_ptr0 + (-1 + 2 * x0 + 8 * x5), tmp30 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp32 = triton_helpers.maximum(tmp31, tmp25)
    tmp33 = tmp29 & tmp15
    tmp34 = tl.load(in_ptr0 + (2 * x0 + 8 * x5), tmp33 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp35 = triton_helpers.maximum(tmp34, tmp32)
    tmp36 = tmp29 & tmp22
    tmp37 = tl.load(in_ptr0 + (1 + 2 * x0 + 8 * x5), tmp36 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp38 = triton_helpers.maximum(tmp37, tmp35)
    tmp39 = 1 + 2 * x1
    tmp40 = tmp39 >= tmp1
    tmp41 = tmp39 < tmp3
    tmp42 = tmp40 & tmp41
    tmp43 = tmp42 & tmp9
    tmp44 = tl.load(in_ptr0 + (3 + 2 * x0 + 8 * x5), tmp43 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp45 = triton_helpers.maximum(tmp44, tmp38)
    tmp46 = tmp42 & tmp15
    tmp47 = tl.load(in_ptr0 + (4 + 2 * x0 + 8 * x5), tmp46 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp48 = triton_helpers.maximum(tmp47, tmp45)
    tmp49 = tmp42 & tmp22
    tmp50 = tl.load(in_ptr0 + (5 + 2 * x0 + 8 * x5), tmp49 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp51 = triton_helpers.maximum(tmp50, tmp48)
    tmp52 = tmp17 > tmp11
    tmp53 = tl.full([1], 1, tl.int8)
    tmp54 = tl.full([1], 0, tl.int8)
    tmp55 = tl.where(tmp52, tmp53, tmp54)
    tmp56 = tmp24 > tmp18
    tmp57 = tl.full([1], 2, tl.int8)
    tmp58 = tl.where(tmp56, tmp57, tmp55)
    tmp59 = tmp31 > tmp25
    tmp60 = tl.full([1], 3, tl.int8)
    tmp61 = tl.where(tmp59, tmp60, tmp58)
    tmp62 = tmp34 > tmp32
    tmp63 = tl.full([1], 4, tl.int8)
    tmp64 = tl.where(tmp62, tmp63, tmp61)
    tmp65 = tmp37 > tmp35
    tmp66 = tl.full([1], 5, tl.int8)
    tmp67 = tl.where(tmp65, tmp66, tmp64)
    tmp68 = tmp44 > tmp38
    tmp69 = tl.full([1], 6, tl.int8)
    tmp70 = tl.where(tmp68, tmp69, tmp67)
    tmp71 = tmp47 > tmp45
    tmp72 = tl.full([1], 7, tl.int8)
    tmp73 = tl.where(tmp71, tmp72, tmp70)
    tmp74 = tmp50 > tmp48
    tmp75 = tl.full([1], 8, tl.int8)
    tmp76 = tl.where(tmp74, tmp75, tmp73)
    tmp77 = tl.load(in_ptr0 + (-5 + 2 * x0 + 8 * x5), tmp10 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp78 = tl.load(in_ptr0 + (-4 + 2 * x0 + 8 * x5), tmp16 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp79 = tmp78 + tmp77
    tmp80 = tl.load(in_ptr0 + (-3 + 2 * x0 + 8 * x5), tmp23 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp81 = tmp80 + tmp79
    tmp82 = tl.load(in_ptr0 + (-1 + 2 * x0 + 8 * x5), tmp30 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp83 = tmp82 + tmp81
    tmp84 = tl.load(in_ptr0 + (2 * x0 + 8 * x5), tmp33 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp85 = tmp84 + tmp83
    tmp86 = tl.load(in_ptr0 + (1 + 2 * x0 + 8 * x5), tmp36 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp87 = tmp86 + tmp85
    tmp88 = tl.load(in_ptr0 + (3 + 2 * x0 + 8 * x5), tmp43 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp89 = tmp88 + tmp87
    tmp90 = tl.load(in_ptr0 + (4 + 2 * x0 + 8 * x5), tmp46 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp91 = tmp90 + tmp89
    tmp92 = tl.load(in_ptr0 + (5 + 2 * x0 + 8 * x5), tmp49 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp93 = tmp92 + tmp91
    tmp94 = 1 + -2 * x0 + -2 * x1 + (5 * (5 <= 2 + 2 * x0) + (2 + 2 * x0) *
        (2 + 2 * x0 < 5)) * (5 * (5 <= 2 + 2 * x1) + (2 + 2 * x1) * (2 + 2 *
        x1 < 5)) + -2 * x0 * (5 * (5 <= 2 + 2 * x1) + (2 + 2 * x1) * (2 + 2 *
        x1 < 5)) + -2 * x1 * (5 * (5 <= 2 + 2 * x0) + (2 + 2 * x0) * (2 + 2 *
        x0 < 5)) + 4 * x0 * x1 + (5 * (5 <= 2 + 2 * x0) + (2 + 2 * x0) * (2 +
        2 * x0 < 5)) + (5 * (5 <= 2 + 2 * x1) + (2 + 2 * x1) * (2 + 2 * x1 < 5)
        )
    tmp95 = tmp93 / tmp94
    tl.store(out_ptr0 + (x6 + 512 * x3), tmp51, xmask)
    tl.store(out_ptr1 + x7, tmp76, xmask)
    tl.store(out_ptr2 + (x6 + 512 * x3), tmp95, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_7(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 // 4 % 64
    tmp0 = tl.load(in_out_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, 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)
    tl.store(in_out_ptr0 + x3, tmp7, xmask)


@triton.jit
def triton_poi_fused_avg_pool2d_max_pool2d_with_indices_8(in_ptr0, out_ptr0,
    out_ptr1, out_ptr2, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 64
    x1 = xindex // 64
    tmp0 = tl.full([1], -1, tl.int64)
    tmp1 = tl.full([1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = tl.full([1], 2, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tmp2 & tmp4
    tmp6 = tmp5 & tmp5
    tmp7 = tl.load(in_ptr0 + (-3 + 4 * x2), tmp6 & xmask, eviction_policy=
        'evict_last', other=float('-inf'))
    tmp8 = tmp1 >= tmp1
    tmp9 = tmp1 < tmp3
    tmp10 = tmp8 & tmp9
    tmp11 = tmp5 & tmp10
    tmp12 = tl.load(in_ptr0 + (-2 + 4 * x2), tmp11 & xmask, eviction_policy
        ='evict_last', other=float('-inf'))
    tmp13 = triton_helpers.maximum(tmp12, tmp7)
    tmp14 = tl.full([1], 1, tl.int64)
    tmp15 = tmp14 >= tmp1
    tmp16 = tmp14 < tmp3
    tmp17 = tmp15 & tmp16
    tmp18 = tmp5 & tmp17
    tmp19 = tl.load(in_ptr0 + (-1 + 4 * x2), tmp18 & xmask, eviction_policy
        ='evict_last', other=float('-inf'))
    tmp20 = triton_helpers.maximum(tmp19, tmp13)
    tmp21 = tmp10 & tmp5
    tmp22 = tl.load(in_ptr0 + (-1 + 4 * x2), tmp21 & xmask, eviction_policy
        ='evict_last', other=float('-inf'))
    tmp23 = triton_helpers.maximum(tmp22, tmp20)
    tmp24 = tmp10 & tmp10
    tmp25 = tl.load(in_ptr0 + 4 * x2, tmp24 & xmask, eviction_policy=
        'evict_last', other=float('-inf'))
    tmp26 = triton_helpers.maximum(tmp25, tmp23)
    tmp27 = tmp10 & tmp17
    tmp28 = tl.load(in_ptr0 + (1 + 4 * x2), tmp27 & xmask, eviction_policy=
        'evict_last', other=float('-inf'))
    tmp29 = triton_helpers.maximum(tmp28, tmp26)
    tmp30 = tmp17 & tmp5
    tmp31 = tl.load(in_ptr0 + (1 + 4 * x2), tmp30 & xmask, eviction_policy=
        'evict_last', other=float('-inf'))
    tmp32 = triton_helpers.maximum(tmp31, tmp29)
    tmp33 = tmp17 & tmp10
    tmp34 = tl.load(in_ptr0 + (2 + 4 * x2), tmp33 & xmask, eviction_policy=
        'evict_last', other=float('-inf'))
    tmp35 = triton_helpers.maximum(tmp34, tmp32)
    tmp36 = tmp17 & tmp17
    tmp37 = tl.load(in_ptr0 + (3 + 4 * x2), tmp36 & xmask, eviction_policy=
        'evict_last', other=float('-inf'))
    tmp38 = triton_helpers.maximum(tmp37, tmp35)
    tmp39 = tmp12 > tmp7
    tmp40 = tl.full([1], 1, tl.int8)
    tmp41 = tl.full([1], 0, tl.int8)
    tmp42 = tl.where(tmp39, tmp40, tmp41)
    tmp43 = tmp19 > tmp13
    tmp44 = tl.full([1], 2, tl.int8)
    tmp45 = tl.where(tmp43, tmp44, tmp42)
    tmp46 = tmp22 > tmp20
    tmp47 = tl.full([1], 3, tl.int8)
    tmp48 = tl.where(tmp46, tmp47, tmp45)
    tmp49 = tmp25 > tmp23
    tmp50 = tl.full([1], 4, tl.int8)
    tmp51 = tl.where(tmp49, tmp50, tmp48)
    tmp52 = tmp28 > tmp26
    tmp53 = tl.full([1], 5, tl.int8)
    tmp54 = tl.where(tmp52, tmp53, tmp51)
    tmp55 = tmp31 > tmp29
    tmp56 = tl.full([1], 6, tl.int8)
    tmp57 = tl.where(tmp55, tmp56, tmp54)
    tmp58 = tmp34 > tmp32
    tmp59 = tl.full([1], 7, tl.int8)
    tmp60 = tl.where(tmp58, tmp59, tmp57)
    tmp61 = tmp37 > tmp35
    tmp62 = tl.full([1], 8, tl.int8)
    tmp63 = tl.where(tmp61, tmp62, tmp60)
    tmp64 = tl.load(in_ptr0 + (-3 + 4 * x2), tmp6 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp65 = tl.load(in_ptr0 + (-2 + 4 * x2), tmp11 & xmask, eviction_policy
        ='evict_last', other=0.0)
    tmp66 = tmp65 + tmp64
    tmp67 = tl.load(in_ptr0 + (-1 + 4 * x2), tmp18 & xmask, eviction_policy
        ='evict_last', other=0.0)
    tmp68 = tmp67 + tmp66
    tmp69 = tl.load(in_ptr0 + (-1 + 4 * x2), tmp21 & xmask, eviction_policy
        ='evict_last', other=0.0)
    tmp70 = tmp69 + tmp68
    tmp71 = tl.load(in_ptr0 + 4 * x2, tmp24 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp72 = tmp71 + tmp70
    tmp73 = tl.load(in_ptr0 + (1 + 4 * x2), tmp27 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp74 = tmp73 + tmp72
    tmp75 = tl.load(in_ptr0 + (1 + 4 * x2), tmp30 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp76 = tmp75 + tmp74
    tmp77 = tl.load(in_ptr0 + (2 + 4 * x2), tmp33 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp78 = tmp77 + tmp76
    tmp79 = tl.load(in_ptr0 + (3 + 4 * x2), tmp36 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp80 = tmp79 + tmp78
    tmp81 = tl.full([1], 9, tl.int32)
    tmp82 = tmp80 / tmp81
    tl.store(out_ptr0 + (x0 + 128 * x1), tmp38, xmask)
    tl.store(out_ptr1 + x2, tmp63, xmask)
    tl.store(out_ptr2 + (x0 + 128 * x1), tmp82, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_9(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
    x2 = xindex
    x0 = xindex % 64
    tmp0 = tl.load(in_out_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + x0, xmask, 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)
    tl.store(in_out_ptr0 + x2, tmp7, xmask)


@triton.jit
def triton_poi_fused__to_copy_10(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 2
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp8, xmask)


@triton.jit
def triton_poi_fused_add_clamp_11(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 2
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tl.full([1], 1, tl.int64)
    tmp10 = tmp8 + tmp9
    tmp11 = tl.full([1], 0, tl.int64)
    tmp12 = triton_helpers.minimum(tmp10, tmp11)
    tl.store(out_ptr0 + x0, tmp12, xmask)


@triton.jit
def triton_poi_fused__to_copy_add_arange_clamp_mul_sub_12(out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 2
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 - tmp9
    tmp11 = triton_helpers.maximum(tmp10, tmp6)
    tmp12 = 1.0
    tmp13 = triton_helpers.minimum(tmp11, tmp12)
    tl.store(out_ptr0 + x0, tmp13, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_add_convolution_leaky_relu_leaky_relu_backward_mul_sub_13(
    in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5,
    in_ptr6, in_ptr7, in_ptr8, in_ptr9, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 2 % 2
    x0 = xindex % 2
    x5 = xindex // 4
    x2 = xindex // 4 % 64
    x6 = xindex
    tmp0 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr2 + x5, xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr3 + x2, xmask, eviction_policy='evict_last')
    tmp17 = tl.load(in_ptr4 + x0, xmask, eviction_policy='evict_last')
    tmp22 = tl.load(in_ptr5 + x0, xmask, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr6 + x6, xmask)
    tmp26 = tl.load(in_ptr7 + x2, xmask, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr8 + x1, xmask, eviction_policy='evict_last')
    tmp36 = tl.load(in_ptr9 + x1, xmask, eviction_policy='evict_last')
    tmp1 = tl.full([XBLOCK], 1, tl.int32)
    tmp2 = tmp0 + tmp1
    tmp3 = tmp0 < 0
    tl.where(tmp3, tmp2, tmp0)
    tmp6 = tmp5 + tmp1
    tmp7 = tmp5 < 0
    tl.where(tmp7, tmp6, tmp5)
    tmp11 = tmp9 + tmp10
    tmp12 = 0.0
    tmp13 = tmp11 > tmp12
    tmp14 = 0.1
    tmp15 = tmp11 * tmp14
    tmp16 = tl.where(tmp13, tmp11, tmp15)
    tmp18 = tmp17 + tmp1
    tmp19 = tmp17 < 0
    tl.where(tmp19, tmp18, tmp17)
    tmp21 = tmp16 - tmp16
    tmp23 = tmp21 * tmp22
    tmp24 = tmp16 + tmp23
    tmp27 = tmp25 + tmp26
    tmp28 = tmp27 > tmp12
    tmp29 = tmp27 * tmp14
    tmp30 = tl.where(tmp28, tmp27, tmp29)
    tmp32 = tmp31 + tmp1
    tmp33 = tmp31 < 0
    tl.where(tmp33, tmp32, tmp31)
    tmp35 = tmp24 - tmp24
    tmp37 = tmp35 * tmp36
    tmp38 = tmp24 + tmp37
    tmp39 = tmp30 + tmp38
    tmp40 = tmp30 > tmp12
    tl.store(in_out_ptr0 + x6, tmp39, xmask)
    tl.store(out_ptr0 + x6, tmp40, xmask)


@triton.jit
def triton_poi_fused__to_copy_14(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 4
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp8, xmask)


@triton.jit
def triton_poi_fused_add_clamp_15(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 4
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tl.full([1], 1, tl.int64)
    tmp10 = tmp8 + tmp9
    tmp11 = triton_helpers.minimum(tmp10, tmp9)
    tl.store(out_ptr0 + x0, tmp11, xmask)


@triton.jit
def triton_poi_fused__to_copy_add_arange_clamp_mul_sub_16(out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 4
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 - tmp9
    tmp11 = triton_helpers.maximum(tmp10, tmp6)
    tmp12 = 1.0
    tmp13 = triton_helpers.minimum(tmp11, tmp12)
    tl.store(out_ptr0 + x0, tmp13, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_add_convolution_leaky_relu_mul_sub_17(
    in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5,
    in_ptr6, in_ptr7, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x1 = xindex // 4 % 4
    x0 = xindex % 4
    x6 = xindex // 16
    x2 = xindex // 16 % 64
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr1 + x0, None, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr3 + x2, None, eviction_policy='evict_last')
    tmp17 = tl.load(in_ptr4 + x0, None, eviction_policy='evict_last')
    tmp27 = tl.load(in_ptr5 + x0, None, eviction_policy='evict_last')
    tmp30 = tl.load(in_ptr6 + x1, None, eviction_policy='evict_last')
    tmp48 = tl.load(in_ptr7 + x1, None, eviction_policy='evict_last')
    tmp1 = tl.full([XBLOCK], 2, tl.int32)
    tmp2 = tmp0 + tmp1
    tmp3 = tmp0 < 0
    tmp4 = tl.where(tmp3, tmp2, tmp0)
    tmp6 = tmp5 + tmp1
    tmp7 = tmp5 < 0
    tmp8 = tl.where(tmp7, tmp6, tmp5)
    tmp9 = tl.load(in_ptr2 + (tmp8 + 2 * tmp4 + 4 * x6), None,
        eviction_policy='evict_last')
    tmp11 = tmp9 + tmp10
    tmp12 = 0.0
    tmp13 = tmp11 > tmp12
    tmp14 = 0.1
    tmp15 = tmp11 * tmp14
    tmp16 = tl.where(tmp13, tmp11, tmp15)
    tmp18 = tmp17 + tmp1
    tmp19 = tmp17 < 0
    tmp20 = tl.where(tmp19, tmp18, tmp17)
    tmp21 = tl.load(in_ptr2 + (tmp20 + 2 * tmp4 + 4 * x6), None,
        eviction_policy='evict_last')
    tmp22 = tmp21 + tmp10
    tmp23 = tmp22 > tmp12
    tmp24 = tmp22 * tmp14
    tmp25 = tl.where(tmp23, tmp22, tmp24)
    tmp26 = tmp25 - tmp16
    tmp28 = tmp26 * tmp27
    tmp29 = tmp16 + tmp28
    tmp31 = tmp30 + tmp1
    tmp32 = tmp30 < 0
    tmp33 = tl.where(tmp32, tmp31, tmp30)
    tmp34 = tl.load(in_ptr2 + (tmp8 + 2 * tmp33 + 4 * x6), None,
        eviction_policy='evict_last')
    tmp35 = tmp34 + tmp10
    tmp36 = tmp35 > tmp12
    tmp37 = tmp35 * tmp14
    tmp38 = tl.where(tmp36, tmp35, tmp37)
    tmp39 = tl.load(in_ptr2 + (tmp20 + 2 * tmp33 + 4 * x6), None,
        eviction_policy='evict_last')
    tmp40 = tmp39 + tmp10
    tmp41 = tmp40 > tmp12
    tmp42 = tmp40 * tmp14
    tmp43 = tl.where(tmp41, tmp40, tmp42)
    tmp44 = tmp43 - tmp38
    tmp45 = tmp44 * tmp27
    tmp46 = tmp38 + tmp45
    tmp47 = tmp46 - tmp29
    tmp49 = tmp47 * tmp48
    tmp50 = tmp29 + tmp49
    tl.store(in_out_ptr0 + x4, tmp50, None)


@triton.jit
def triton_poi_fused_add_convolution_leaky_relu_mul_sigmoid_18(in_out_ptr0,
    in_out_ptr1, in_ptr0, in_ptr1, in_ptr2, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 16 % 64
    tmp0 = tl.load(in_out_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr1 + x3, None)
    tmp13 = tl.load(in_out_ptr1 + x3, None)
    tmp14 = tl.load(in_ptr2 + x1, None, 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)
    tmp9 = tl.sigmoid(tmp8)
    tmp10 = tmp7 * tmp9
    tmp11 = 2.0
    tmp12 = tmp10 * tmp11
    tmp15 = tmp13 + tmp14
    tmp16 = tmp12 + tmp15
    tl.store(in_out_ptr0 + x3, tmp2, None)
    tl.store(in_out_ptr1 + x3, tmp16, None)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_19(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
    x1 = xindex // 4 % 64
    tmp0 = tl.load(in_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, 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 + x3, tmp8, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_20(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
    x2 = xindex
    x0 = xindex % 64
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x0, xmask, 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 + x2, tmp8, 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, primals_25, primals_26, primals_27) = args
    args.clear()
    assert_size_stride(primals_1, (4, 5, 64, 4, 4), (5120, 1024, 16, 4, 1))
    assert_size_stride(primals_2, (64, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_3, (64,), (1,))
    assert_size_stride(primals_4, (64, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_5, (64,), (1,))
    assert_size_stride(primals_6, (64, 320, 1, 1), (320, 1, 1, 1))
    assert_size_stride(primals_7, (64,), (1,))
    assert_size_stride(primals_8, (64, 320, 1, 1), (320, 1, 1, 1))
    assert_size_stride(primals_9, (64,), (1,))
    assert_size_stride(primals_10, (64, 128, 1, 1), (128, 1, 1, 1))
    assert_size_stride(primals_11, (64,), (1,))
    assert_size_stride(primals_12, (64, 64, 1, 1), (64, 1, 1, 1))
    assert_size_stride(primals_13, (64,), (1,))
    assert_size_stride(primals_14, (64, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_15, (64,), (1,))
    assert_size_stride(primals_16, (64, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_17, (64,), (1,))
    assert_size_stride(primals_18, (64, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_19, (64,), (1,))
    assert_size_stride(primals_20, (64, 64, 1, 1), (64, 1, 1, 1))
    assert_size_stride(primals_21, (64,), (1,))
    assert_size_stride(primals_22, (64, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_23, (64,), (1,))
    assert_size_stride(primals_24, (64, 64, 1, 1), (64, 1, 1, 1))
    assert_size_stride(primals_25, (64,), (1,))
    assert_size_stride(primals_26, (64, 64, 1, 1), (64, 1, 1, 1))
    assert_size_stride(primals_27, (64,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 64, 4, 4), (1024, 16, 4, 1), torch.
            float32)
        get_raw_stream(0)
        triton_poi_fused_clone_0[grid(4096)](primals_1, buf0, 4096, 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, 64, 4, 4), (1024, 16, 4, 1))
        buf2 = buf1
        del buf1
        triton_poi_fused_convolution_1[grid(4096)](buf2, primals_3, 4096,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_3
        buf3 = extern_kernels.convolution(reinterpret_tensor(primals_1, (20,
            64, 4, 4), (1024, 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, (20, 64, 4, 4), (1024, 16, 4, 1))
        buf4 = buf3
        del buf3
        triton_poi_fused_convolution_2[grid(20480)](buf4, primals_5, 20480,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_5
        buf15 = empty_strided_cuda((4, 5, 4, 4), (80, 16, 4, 1), torch.float32)
        buf10 = reinterpret_tensor(buf15, (4, 1, 4, 4), (80, 16, 4, 1), 0)
        buf11 = reinterpret_tensor(buf15, (4, 1, 4, 4), (80, 16, 4, 1), 16)
        buf12 = reinterpret_tensor(buf15, (4, 1, 4, 4), (80, 16, 4, 1), 32)
        buf13 = reinterpret_tensor(buf15, (4, 1, 4, 4), (80, 16, 4, 1), 48)
        buf14 = reinterpret_tensor(buf15, (4, 1, 4, 4), (80, 16, 4, 1), 64)
        triton_per_fused_cat_mul_sum_3[grid(64)](buf4, buf2, buf10, buf11,
            buf12, buf13, buf14, 64, 64, XBLOCK=32, num_warps=8, num_stages=1)
        buf16 = empty_strided_cuda((4, 320, 4, 4), (5120, 16, 4, 1), torch.
            float32)
        triton_poi_fused_mul_4[grid(20480)](primals_1, buf15, buf16, 20480,
            XBLOCK=256, num_warps=4, num_stages=1)
        buf17 = extern_kernels.convolution(buf16, primals_6, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf17, (4, 64, 4, 4), (1024, 16, 4, 1))
        buf19 = extern_kernels.convolution(buf16, primals_8, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf19, (4, 64, 4, 4), (1024, 16, 4, 1))
        buf20 = buf19
        del buf19
        triton_poi_fused_convolution_leaky_relu_5[grid(4096)](buf20,
            primals_9, 4096, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_9
        buf24 = empty_strided_cuda((4, 128, 2, 2), (512, 4, 2, 1), torch.
            float32)
        buf21 = reinterpret_tensor(buf24, (4, 64, 2, 2), (512, 4, 2, 1), 0)
        buf22 = empty_strided_cuda((4, 64, 2, 2), (256, 4, 2, 1), torch.int8)
        buf23 = reinterpret_tensor(buf24, (4, 64, 2, 2), (512, 4, 2, 1), 256)
        triton_poi_fused_avg_pool2d_max_pool2d_with_indices_6[grid(1024)](buf20
            , buf21, buf22, buf23, 1024, XBLOCK=128, num_warps=4, num_stages=1)
        buf25 = extern_kernels.convolution(buf24, primals_10, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf25, (4, 64, 2, 2), (256, 4, 2, 1))
        buf26 = buf25
        del buf25
        triton_poi_fused_convolution_leaky_relu_7[grid(1024)](buf26,
            primals_11, 1024, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_11
        buf27 = extern_kernels.convolution(buf26, primals_12, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf27, (4, 64, 2, 2), (256, 4, 2, 1))
        buf28 = buf27
        del buf27
        triton_poi_fused_convolution_leaky_relu_7[grid(1024)](buf28,
            primals_13, 1024, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_13
        buf32 = empty_strided_cuda((4, 128, 1, 1), (128, 1, 1, 1), torch.
            float32)
        buf29 = reinterpret_tensor(buf32, (4, 64, 1, 1), (128, 1, 1, 1), 0)
        buf30 = empty_strided_cuda((4, 64, 1, 1), (64, 1, 1, 1), torch.int8)
        buf31 = reinterpret_tensor(buf32, (4, 64, 1, 1), (128, 1, 1, 1), 64)
        triton_poi_fused_avg_pool2d_max_pool2d_with_indices_8[grid(256)](buf28,
            buf29, buf30, buf31, 256, XBLOCK=128, num_warps=4, num_stages=1)
        buf33 = extern_kernels.convolution(buf32, primals_14, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf33, (4, 64, 1, 1), (64, 1, 1, 1))
        buf34 = buf33
        del buf33
        triton_poi_fused_convolution_leaky_relu_9[grid(256)](buf34,
            primals_15, 256, XBLOCK=128, num_warps=4, num_stages=1)
        del primals_15
        buf35 = extern_kernels.convolution(buf34, primals_16, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf35, (4, 64, 1, 1), (64, 1, 1, 1))
        buf36 = empty_strided_cuda((2, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_10[grid(2)](buf36, 2, XBLOCK=2, num_warps
            =1, num_stages=1)
        buf37 = empty_strided_cuda((2, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_11[grid(2)](buf37, 2, XBLOCK=2,
            num_warps=1, num_stages=1)
        buf38 = empty_strided_cuda((2,), (1,), torch.int64)
        triton_poi_fused__to_copy_10[grid(2)](buf38, 2, XBLOCK=2, num_warps
            =1, num_stages=1)
        buf39 = empty_strided_cuda((2,), (1,), torch.int64)
        triton_poi_fused_add_clamp_11[grid(2)](buf39, 2, XBLOCK=2,
            num_warps=1, num_stages=1)
        buf40 = empty_strided_cuda((2,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_12[grid(2)](buf40,
            2, XBLOCK=2, num_warps=1, num_stages=1)
        buf42 = empty_strided_cuda((2, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_12[grid(2)](buf42,
            2, XBLOCK=2, num_warps=1, num_stages=1)
        buf43 = extern_kernels.convolution(buf26, primals_18, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf43, (4, 64, 2, 2), (256, 4, 2, 1))
        buf41 = empty_strided_cuda((4, 64, 2, 2), (256, 4, 2, 1), torch.float32
            )
        buf44 = buf41
        del buf41
        buf62 = empty_strided_cuda((4, 64, 2, 2), (256, 4, 2, 1), torch.bool)
        triton_poi_fused__unsafe_index_add_convolution_leaky_relu_leaky_relu_backward_mul_sub_13[
            grid(1024)](buf44, buf36, buf38, buf35, primals_17, buf39,
            buf40, buf43, primals_19, buf37, buf42, buf62, 1024, XBLOCK=128,
            num_warps=4, num_stages=1)
        del buf43
        del primals_19
        buf45 = extern_kernels.convolution(buf44, primals_20, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf45, (4, 64, 2, 2), (256, 4, 2, 1))
        buf46 = empty_strided_cuda((4, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_14[grid(4)](buf46, 4, XBLOCK=4, num_warps
            =1, num_stages=1)
        buf47 = empty_strided_cuda((4, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_15[grid(4)](buf47, 4, XBLOCK=4,
            num_warps=1, num_stages=1)
        buf48 = empty_strided_cuda((4,), (1,), torch.int64)
        triton_poi_fused__to_copy_14[grid(4)](buf48, 4, XBLOCK=4, num_warps
            =1, num_stages=1)
        buf49 = empty_strided_cuda((4,), (1,), torch.int64)
        triton_poi_fused_add_clamp_15[grid(4)](buf49, 4, XBLOCK=4,
            num_warps=1, num_stages=1)
        buf50 = empty_strided_cuda((4,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_16[grid(4)](buf50,
            4, XBLOCK=4, num_warps=1, num_stages=1)
        buf52 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_16[grid(4)](buf52,
            4, XBLOCK=4, num_warps=1, num_stages=1)
        buf53 = empty_strided_cuda((4, 64, 4, 4), (1024, 16, 4, 1), torch.
            float32)
        buf54 = buf53
        del buf53
        triton_poi_fused__unsafe_index_add_convolution_leaky_relu_mul_sub_17[
            grid(4096)](buf54, buf46, buf48, buf45, primals_21, buf49,
            buf50, buf47, buf52, 4096, XBLOCK=128, num_warps=4, num_stages=1)
        buf55 = extern_kernels.convolution(buf54, primals_22, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf55, (4, 64, 4, 4), (1024, 16, 4, 1))
        buf56 = buf55
        del buf55
        triton_poi_fused_convolution_1[grid(4096)](buf56, primals_23, 4096,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_23
        buf57 = extern_kernels.convolution(buf56, primals_24, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf57, (4, 64, 4, 4), (1024, 16, 4, 1))
        buf58 = buf57
        del buf57
        triton_poi_fused_convolution_leaky_relu_5[grid(4096)](buf58,
            primals_25, 4096, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_25
        buf59 = extern_kernels.convolution(buf58, primals_26, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf59, (4, 64, 4, 4), (1024, 16, 4, 1))
        buf18 = buf17
        del buf17
        buf60 = buf59
        del buf59
        triton_poi_fused_add_convolution_leaky_relu_mul_sigmoid_18[grid(4096)](
            buf18, buf60, primals_7, buf56, primals_27, 4096, XBLOCK=256,
            num_warps=4, num_stages=1)
        del primals_27
        del primals_7
        buf61 = empty_strided_cuda((4, 64, 2, 2), (256, 4, 2, 1), torch.bool)
        triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_19[grid
            (1024)](buf45, primals_21, buf61, 1024, XBLOCK=256, num_warps=4,
            num_stages=1)
        del buf45
        del primals_21
        buf63 = empty_strided_cuda((4, 64, 1, 1), (64, 1, 1, 1), torch.bool)
        triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_20[grid
            (256)](buf35, primals_17, buf63, 256, XBLOCK=128, num_warps=4,
            num_stages=1)
        del buf35
        del primals_17
    return (buf60, primals_1, primals_2, primals_4, primals_6, primals_8,
        primals_10, primals_12, primals_14, primals_16, primals_18,
        primals_20, primals_22, primals_24, primals_26, buf0, buf2,
        reinterpret_tensor(buf4, (4, 64, 4, 4), (5120, 16, 4, 1), 0),
        reinterpret_tensor(buf4, (4, 64, 4, 4), (5120, 16, 4, 1), 1024),
        reinterpret_tensor(buf4, (4, 64, 4, 4), (5120, 16, 4, 1), 2048),
        reinterpret_tensor(buf4, (4, 64, 4, 4), (5120, 16, 4, 1), 3072),
        reinterpret_tensor(buf4, (4, 64, 4, 4), (5120, 16, 4, 1), 4096),
        buf15, buf16, buf18, buf20, buf22, buf24, buf26, buf28, buf30,
        buf32, buf34, buf36, buf37, buf38, buf39, buf40, buf42, buf44,
        buf46, buf47, buf48, buf49, buf50, buf52, buf54, buf56, buf58,
        buf61, buf62, buf63)


class TSAFusionNew(nn.Module):
    """Temporal Spatial Attention (TSA) fusion module.

    Temporal: Calculate the correlation between center frame and
        neighboring frames;
    Spatial: It has 3 pyramid levels, the attention is similar to SFT.
        (SFT: Recovering realistic texture in image super-resolution by deep
            spatial feature transform.)

    Args:
        num_feat (int): Channel number of middle features. Default: 64.
        num_frame (int): Number of frames. Default: 5.
        center_frame_idx (int): The index of center frame. Default: 2.
    """

    def __init__(self, num_feat=64, num_frame=5, center_frame_idx=2):
        super(TSAFusionNew, self).__init__()
        self.center_frame_idx = center_frame_idx
        self.temporal_attn1 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
        self.temporal_attn2 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
        self.feat_fusion = nn.Conv2d(num_frame * num_feat, num_feat, 1, 1)
        self.max_pool = nn.MaxPool2d(3, stride=2, padding=1)
        self.avg_pool = nn.AvgPool2d(3, stride=2, padding=1)
        self.spatial_attn1 = nn.Conv2d(num_frame * num_feat, num_feat, 1)
        self.spatial_attn2 = nn.Conv2d(num_feat * 2, num_feat, 1)
        self.spatial_attn3 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
        self.spatial_attn4 = nn.Conv2d(num_feat, num_feat, 1)
        self.spatial_attn5 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
        self.spatial_attn_l1 = nn.Conv2d(num_feat, num_feat, 1)
        self.spatial_attn_l2 = nn.Conv2d(num_feat * 2, num_feat, 3, 1, 1)
        self.spatial_attn_l3 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
        self.spatial_attn_add1 = nn.Conv2d(num_feat, num_feat, 1)
        self.spatial_attn_add2 = nn.Conv2d(num_feat, num_feat, 1)
        self.lrelu = nn.LeakyReLU(negative_slope=0.1, inplace=True)
        self.upsample = nn.Upsample(scale_factor=2, mode='bilinear',
            align_corners=False)

    def forward(self, input_0):
        primals_2 = self.temporal_attn1.weight
        primals_3 = self.temporal_attn1.bias
        primals_4 = self.temporal_attn2.weight
        primals_5 = self.temporal_attn2.bias
        primals_6 = self.feat_fusion.weight
        primals_7 = self.feat_fusion.bias
        primals_8 = self.spatial_attn1.weight
        primals_9 = self.spatial_attn1.bias
        primals_10 = self.spatial_attn2.weight
        primals_11 = self.spatial_attn2.bias
        primals_16 = self.spatial_attn3.weight
        primals_13 = self.spatial_attn3.bias
        primals_12 = self.spatial_attn4.weight
        primals_15 = self.spatial_attn4.bias
        primals_18 = self.spatial_attn5.weight
        primals_17 = self.spatial_attn5.bias
        primals_20 = self.spatial_attn_l1.weight
        primals_19 = self.spatial_attn_l1.bias
        primals_14 = self.spatial_attn_l2.weight
        primals_21 = self.spatial_attn_l2.bias
        primals_22 = self.spatial_attn_l3.weight
        primals_23 = self.spatial_attn_l3.bias
        primals_24 = self.spatial_attn_add1.weight
        primals_25 = self.spatial_attn_add1.bias
        primals_26 = self.spatial_attn_add2.weight
        primals_27 = self.spatial_attn_add2.bias
        primals_1 = input_0
        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,
            primals_25, primals_26, primals_27])
        return output[0]


Measured latency_ms: 0.121414