import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_mul_sub_0(
    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)
    x1 = xindex // 8 % 8
    x0 = xindex % 8
    x2 = xindex // 64
    x4 = xindex
    tmp0 = x1
    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], 3, tl.int64)
    tmp12 = triton_helpers.minimum(tmp10, tmp11)
    tmp13 = x0
    tmp14 = tmp13.to(tl.float32)
    tmp15 = tmp14 + tmp2
    tmp16 = tmp15 * tmp2
    tmp17 = tmp16 - tmp2
    tmp18 = triton_helpers.maximum(tmp17, tmp6)
    tmp19 = tmp18.to(tl.int32)
    tmp20 = tmp19 + tmp9
    tmp21 = triton_helpers.minimum(tmp20, tmp11)
    tmp22 = tl.load(in_ptr0 + (tmp21 + 4 * tmp12 + 16 * x2), None,
        eviction_policy='evict_last')
    tmp23 = tl.load(in_ptr0 + (tmp19 + 4 * tmp12 + 16 * x2), None,
        eviction_policy='evict_last')
    tmp24 = tmp22 - tmp23
    tmp25 = tmp19.to(tl.float32)
    tmp26 = tmp18 - tmp25
    tmp27 = triton_helpers.maximum(tmp26, tmp6)
    tmp28 = 1.0
    tmp29 = triton_helpers.minimum(tmp27, tmp28)
    tmp30 = tmp24 * tmp29
    tmp31 = tmp23 + tmp30
    tmp32 = tl.load(in_ptr0 + (tmp19 + 4 * tmp8 + 16 * x2), None,
        eviction_policy='evict_last')
    tmp33 = tl.load(in_ptr0 + (tmp21 + 4 * tmp8 + 16 * x2), None,
        eviction_policy='evict_last')
    tmp34 = tmp33 - tmp32
    tmp35 = tmp34 * tmp29
    tmp36 = tmp32 + tmp35
    tmp37 = tmp31 - tmp36
    tmp38 = tmp8.to(tl.float32)
    tmp39 = tmp7 - tmp38
    tmp40 = triton_helpers.maximum(tmp39, tmp6)
    tmp41 = triton_helpers.minimum(tmp40, tmp28)
    tmp42 = tmp37 * tmp41
    tmp43 = tmp36 + tmp42
    tl.store(in_out_ptr0 + x4, tmp43, None)


@triton.jit
def triton_poi_fused_reflection_pad2d_1(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 % 10
    x1 = xindex // 10 % 10
    x2 = xindex // 100
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (63 + -1 * tl_math.abs(-7 + tl_math.abs(-1 +
        x0)) + -8 * tl_math.abs(-7 + tl_math.abs(-1 + x1)) + 64 * x2), None,
        eviction_policy='evict_last')
    tl.store(out_ptr0 + x3, tmp0, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_2(in_out_ptr0,
    in_ptr0, out_ptr0, out_ptr1, out_ptr2, xnumel, rnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 1024
    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
    x3 = xindex
    x0 = xindex % 256
    tmp0 = tl.load(in_out_ptr0 + (r2 + 64 * x3), xmask, other=0.0)
    tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.2
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = tl.broadcast_to(tmp7, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp8, 0)
    tmp11 = tl.broadcast_to(tmp8, [XBLOCK, RBLOCK])
    tmp13 = tl.where(xmask, tmp11, 0)
    tmp14 = tl.sum(tmp13, 1)[:, None]
    tmp15 = tl.full([XBLOCK, 1], 64, tl.int32)
    tmp16 = tmp15.to(tl.float32)
    tmp17 = tmp14 / tmp16
    tmp18 = tmp8 - tmp17
    tmp19 = tmp18 * tmp18
    tmp20 = tl.broadcast_to(tmp19, [XBLOCK, RBLOCK])
    tmp22 = tl.where(xmask, tmp20, 0)
    tmp23 = tl.sum(tmp22, 1)[:, None]
    tmp24 = 64.0
    tmp25 = tmp23 / tmp24
    tmp26 = 1e-05
    tmp27 = tmp25 + tmp26
    tmp28 = libdevice.rsqrt(tmp27)
    tl.store(in_out_ptr0 + (r2 + 64 * x3), tmp2, xmask)
    tl.store(out_ptr2 + x3, tmp28, xmask)
    tl.store(out_ptr0 + x3, tmp17, xmask)
    tl.store(out_ptr1 + x3, tmp23, xmask)


@triton.jit
def triton_poi_fused_reflection_pad2d_3(in_ptr0, in_ptr1, in_ptr2, 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 % 10
    x1 = xindex // 10 % 10
    x2 = xindex // 100
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (63 + -1 * tl_math.abs(-7 + tl_math.abs(-1 +
        x0)) + -8 * tl_math.abs(-7 + tl_math.abs(-1 + x1)) + 64 * x2), None,
        eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr1 + x2, None, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr2 + x2, None, eviction_policy='evict_last')
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 0.2
    tmp4 = tmp0 * tmp3
    tmp5 = tl.where(tmp2, tmp0, tmp4)
    tmp7 = tmp5 - tmp6
    tmp9 = 64.0
    tmp10 = tmp8 / tmp9
    tmp11 = 1e-05
    tmp12 = tmp10 + tmp11
    tmp13 = libdevice.rsqrt(tmp12)
    tmp14 = tmp7 * tmp13
    tl.store(out_ptr0 + x3, tmp14, None)


@triton.jit
def triton_poi_fused__to_copy_4(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 = 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_5(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 = 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], 7, 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_6(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 = 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_mul_sub_7(in_out_ptr1, in_ptr0,
    in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8,
    in_ptr9, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x1 = xindex // 16 % 16
    x0 = xindex % 16
    x2 = xindex // 256
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr1 + x0, None, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr4 + x2, None, eviction_policy='evict_last')
    tmp18 = tl.load(in_ptr5 + x2, None, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr6 + x1, None, eviction_policy='evict_last')
    tmp38 = tl.load(in_ptr7 + x0, None, eviction_policy='evict_last')
    tmp51 = tl.load(in_ptr8 + x0, None, eviction_policy='evict_last')
    tmp66 = tl.load(in_ptr9 + x1, None, eviction_policy='evict_last')
    tmp1 = tl.full([XBLOCK], 8, 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 + 8 * tmp4 + 64 * x2), None,
        eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr3 + (tmp8 + 8 * tmp4 + 64 * x2), None,
        eviction_policy='evict_last')
    tmp11 = 0.0
    tmp12 = tmp10 > tmp11
    tmp13 = 0.2
    tmp14 = tmp10 * tmp13
    tmp15 = tl.where(tmp12, tmp10, tmp14)
    tmp17 = tmp15 - tmp16
    tmp19 = 64.0
    tmp20 = tmp18 / tmp19
    tmp21 = 1e-05
    tmp22 = tmp20 + tmp21
    tmp23 = libdevice.rsqrt(tmp22)
    tmp24 = tmp17 * tmp23
    tmp25 = tmp9 + tmp24
    tmp27 = tmp26 + tmp1
    tmp28 = tmp26 < 0
    tmp29 = tl.where(tmp28, tmp27, tmp26)
    tmp30 = tl.load(in_ptr2 + (tmp8 + 8 * tmp29 + 64 * x2), None,
        eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr3 + (tmp8 + 8 * tmp29 + 64 * x2), None,
        eviction_policy='evict_last')
    tmp32 = tmp31 > tmp11
    tmp33 = tmp31 * tmp13
    tmp34 = tl.where(tmp32, tmp31, tmp33)
    tmp35 = tmp34 - tmp16
    tmp36 = tmp35 * tmp23
    tmp37 = tmp30 + tmp36
    tmp39 = tmp38 + tmp1
    tmp40 = tmp38 < 0
    tmp41 = tl.where(tmp40, tmp39, tmp38)
    tmp42 = tl.load(in_ptr2 + (tmp41 + 8 * tmp29 + 64 * x2), None,
        eviction_policy='evict_last')
    tmp43 = tl.load(in_ptr3 + (tmp41 + 8 * tmp29 + 64 * x2), None,
        eviction_policy='evict_last')
    tmp44 = tmp43 > tmp11
    tmp45 = tmp43 * tmp13
    tmp46 = tl.where(tmp44, tmp43, tmp45)
    tmp47 = tmp46 - tmp16
    tmp48 = tmp47 * tmp23
    tmp49 = tmp42 + tmp48
    tmp50 = tmp49 - tmp37
    tmp52 = tmp50 * tmp51
    tmp53 = tmp37 + tmp52
    tmp54 = tl.load(in_ptr2 + (tmp41 + 8 * tmp4 + 64 * x2), None,
        eviction_policy='evict_last')
    tmp55 = tl.load(in_ptr3 + (tmp41 + 8 * tmp4 + 64 * x2), None,
        eviction_policy='evict_last')
    tmp56 = tmp55 > tmp11
    tmp57 = tmp55 * tmp13
    tmp58 = tl.where(tmp56, tmp55, tmp57)
    tmp59 = tmp58 - tmp16
    tmp60 = tmp59 * tmp23
    tmp61 = tmp54 + tmp60
    tmp62 = tmp61 - tmp25
    tmp63 = tmp62 * tmp51
    tmp64 = tmp25 + tmp63
    tmp65 = tmp64 - tmp53
    tmp67 = tmp65 * tmp66
    tmp68 = tmp53 + tmp67
    tl.store(in_out_ptr1 + x4, tmp68, None)


@triton.jit
def triton_poi_fused_reflection_pad2d_8(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 % 18
    x1 = xindex // 18 % 18
    x2 = xindex // 324
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (255 + -1 * tl_math.abs(-15 + tl_math.abs(-1 +
        x0)) + -16 * tl_math.abs(-15 + tl_math.abs(-1 + x1)) + 256 * x2),
        None, eviction_policy='evict_last')
    tl.store(out_ptr0 + x3, tmp0, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_9(in_out_ptr0,
    in_ptr0, out_ptr0, out_ptr1, out_ptr2, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r2 = rindex
    x3 = xindex
    x0 = xindex % 128
    tmp0 = tl.load(in_out_ptr0 + (r2 + 256 * x3), None)
    tmp1 = tl.load(in_ptr0 + x0, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.2
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = tl.broadcast_to(tmp7, [RBLOCK])
    tmp10 = tl.broadcast_to(tmp8, [RBLOCK])
    tmp12 = triton_helpers.promote_to_tensor(tl.sum(tmp10, 0))
    tmp13 = tl.full([1], 256, tl.int32)
    tmp14 = tmp13.to(tl.float32)
    tmp15 = tmp12 / tmp14
    tmp16 = tmp8 - tmp15
    tmp17 = tmp16 * tmp16
    tmp18 = tl.broadcast_to(tmp17, [RBLOCK])
    tmp20 = triton_helpers.promote_to_tensor(tl.sum(tmp18, 0))
    tmp21 = 256.0
    tmp22 = tmp20 / tmp21
    tmp23 = 1e-05
    tmp24 = tmp22 + tmp23
    tmp25 = libdevice.rsqrt(tmp24)
    tl.store(in_out_ptr0 + (r2 + 256 * x3), tmp2, None)
    tl.store(out_ptr2 + x3, tmp25, None)
    tl.store(out_ptr0 + x3, tmp15, None)
    tl.store(out_ptr1 + x3, tmp20, None)


@triton.jit
def triton_poi_fused_reflection_pad2d_10(in_ptr0, in_ptr1, in_ptr2,
    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 % 18
    x1 = xindex // 18 % 18
    x2 = xindex // 324
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (255 + -1 * tl_math.abs(-15 + tl_math.abs(-1 +
        x0)) + -16 * tl_math.abs(-15 + tl_math.abs(-1 + x1)) + 256 * x2),
        None, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr1 + x2, None, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr2 + x2, None, eviction_policy='evict_last')
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 0.2
    tmp4 = tmp0 * tmp3
    tmp5 = tl.where(tmp2, tmp0, tmp4)
    tmp7 = tmp5 - tmp6
    tmp9 = 256.0
    tmp10 = tmp8 / tmp9
    tmp11 = 1e-05
    tmp12 = tmp10 + tmp11
    tmp13 = libdevice.rsqrt(tmp12)
    tmp14 = tmp7 * tmp13
    tl.store(out_ptr0 + x3, tmp14, None)


@triton.jit
def triton_poi_fused__to_copy_11(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 32
    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_12(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 32
    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], 15, 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_13(out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 32
    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_mul_sub_14(in_out_ptr1, in_ptr0,
    in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8,
    in_ptr9, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x1 = xindex // 32 % 32
    x0 = xindex % 32
    x2 = xindex // 1024
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr1 + x0, None, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr4 + x2, None, eviction_policy='evict_last')
    tmp18 = tl.load(in_ptr5 + x2, None, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr6 + x1, None, eviction_policy='evict_last')
    tmp38 = tl.load(in_ptr7 + x0, None, eviction_policy='evict_last')
    tmp51 = tl.load(in_ptr8 + x0, None, eviction_policy='evict_last')
    tmp66 = tl.load(in_ptr9 + x1, None, eviction_policy='evict_last')
    tmp1 = tl.full([XBLOCK], 16, 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 + 16 * tmp4 + 256 * x2), None,
        eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr3 + (tmp8 + 16 * tmp4 + 256 * x2), None,
        eviction_policy='evict_last')
    tmp11 = 0.0
    tmp12 = tmp10 > tmp11
    tmp13 = 0.2
    tmp14 = tmp10 * tmp13
    tmp15 = tl.where(tmp12, tmp10, tmp14)
    tmp17 = tmp15 - tmp16
    tmp19 = 256.0
    tmp20 = tmp18 / tmp19
    tmp21 = 1e-05
    tmp22 = tmp20 + tmp21
    tmp23 = libdevice.rsqrt(tmp22)
    tmp24 = tmp17 * tmp23
    tmp25 = tmp9 + tmp24
    tmp27 = tmp26 + tmp1
    tmp28 = tmp26 < 0
    tmp29 = tl.where(tmp28, tmp27, tmp26)
    tmp30 = tl.load(in_ptr2 + (tmp8 + 16 * tmp29 + 256 * x2), None,
        eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr3 + (tmp8 + 16 * tmp29 + 256 * x2), None,
        eviction_policy='evict_last')
    tmp32 = tmp31 > tmp11
    tmp33 = tmp31 * tmp13
    tmp34 = tl.where(tmp32, tmp31, tmp33)
    tmp35 = tmp34 - tmp16
    tmp36 = tmp35 * tmp23
    tmp37 = tmp30 + tmp36
    tmp39 = tmp38 + tmp1
    tmp40 = tmp38 < 0
    tmp41 = tl.where(tmp40, tmp39, tmp38)
    tmp42 = tl.load(in_ptr2 + (tmp41 + 16 * tmp29 + 256 * x2), None,
        eviction_policy='evict_last')
    tmp43 = tl.load(in_ptr3 + (tmp41 + 16 * tmp29 + 256 * x2), None,
        eviction_policy='evict_last')
    tmp44 = tmp43 > tmp11
    tmp45 = tmp43 * tmp13
    tmp46 = tl.where(tmp44, tmp43, tmp45)
    tmp47 = tmp46 - tmp16
    tmp48 = tmp47 * tmp23
    tmp49 = tmp42 + tmp48
    tmp50 = tmp49 - tmp37
    tmp52 = tmp50 * tmp51
    tmp53 = tmp37 + tmp52
    tmp54 = tl.load(in_ptr2 + (tmp41 + 16 * tmp4 + 256 * x2), None,
        eviction_policy='evict_last')
    tmp55 = tl.load(in_ptr3 + (tmp41 + 16 * tmp4 + 256 * x2), None,
        eviction_policy='evict_last')
    tmp56 = tmp55 > tmp11
    tmp57 = tmp55 * tmp13
    tmp58 = tl.where(tmp56, tmp55, tmp57)
    tmp59 = tmp58 - tmp16
    tmp60 = tmp59 * tmp23
    tmp61 = tmp54 + tmp60
    tmp62 = tmp61 - tmp25
    tmp63 = tmp62 * tmp51
    tmp64 = tmp25 + tmp63
    tmp65 = tmp64 - tmp53
    tmp67 = tmp65 * tmp66
    tmp68 = tmp53 + tmp67
    tl.store(in_out_ptr1 + x4, tmp68, None)


@triton.jit
def triton_poi_fused_reflection_pad2d_15(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 % 34
    x1 = xindex // 34 % 34
    x2 = xindex // 1156
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (1023 + -1 * tl_math.abs(-31 + tl_math.abs(-1 +
        x0)) + -32 * tl_math.abs(-31 + tl_math.abs(-1 + x1)) + 1024 * x2),
        None, eviction_policy='evict_last')
    tl.store(out_ptr0 + x3, tmp0, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_16(in_out_ptr0,
    in_ptr0, out_ptr0, out_ptr1, out_ptr2, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r2 = rindex
    x3 = xindex
    x0 = xindex % 64
    tmp0 = tl.load(in_out_ptr0 + (r2 + 1024 * x3), None)
    tmp1 = tl.load(in_ptr0 + x0, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.2
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = tl.broadcast_to(tmp7, [RBLOCK])
    tmp10 = tl.broadcast_to(tmp8, [RBLOCK])
    tmp12 = triton_helpers.promote_to_tensor(tl.sum(tmp10, 0))
    tmp13 = tl.full([1], 1024, tl.int32)
    tmp14 = tmp13.to(tl.float32)
    tmp15 = tmp12 / tmp14
    tmp16 = tmp8 - tmp15
    tmp17 = tmp16 * tmp16
    tmp18 = tl.broadcast_to(tmp17, [RBLOCK])
    tmp20 = triton_helpers.promote_to_tensor(tl.sum(tmp18, 0))
    tmp21 = 1024.0
    tmp22 = tmp20 / tmp21
    tmp23 = 1e-05
    tmp24 = tmp22 + tmp23
    tmp25 = libdevice.rsqrt(tmp24)
    tl.store(in_out_ptr0 + (r2 + 1024 * x3), tmp2, None)
    tl.store(out_ptr2 + x3, tmp25, None)
    tl.store(out_ptr0 + x3, tmp15, None)
    tl.store(out_ptr1 + x3, tmp20, None)


@triton.jit
def triton_poi_fused_reflection_pad2d_17(in_ptr0, in_ptr1, in_ptr2,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 295936
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 34
    x1 = xindex // 34 % 34
    x2 = xindex // 1156
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (1023 + -1 * tl_math.abs(-31 + tl_math.abs(-1 +
        x0)) + -32 * tl_math.abs(-31 + tl_math.abs(-1 + x1)) + 1024 * x2),
        xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr2 + x2, xmask, eviction_policy='evict_last')
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 0.2
    tmp4 = tmp0 * tmp3
    tmp5 = tl.where(tmp2, tmp0, tmp4)
    tmp7 = tmp5 - tmp6
    tmp9 = 1024.0
    tmp10 = tmp8 / tmp9
    tmp11 = 1e-05
    tmp12 = tmp10 + tmp11
    tmp13 = libdevice.rsqrt(tmp12)
    tmp14 = tmp7 * tmp13
    tl.store(out_ptr0 + x3, tmp14, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_add_convolution_18(in_out_ptr0,
    in_out_ptr1, in_ptr0, out_ptr0, out_ptr2, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r2 = rindex
    x3 = xindex
    x0 = xindex % 64
    tmp0 = tl.load(in_out_ptr0 + (r2 + 1024 * x3), None)
    tmp1 = tl.load(in_ptr0 + x0, None, eviction_policy='evict_last')
    tmp21 = tl.load(in_out_ptr1 + (r2 + 1024 * x3), None)
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.2
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = tl.broadcast_to(tmp7, [RBLOCK])
    tmp10 = tl.broadcast_to(tmp8, [RBLOCK])
    tmp12 = triton_helpers.promote_to_tensor(tl.sum(tmp10, 0))
    tmp13 = tl.full([1], 1024, tl.int32)
    tmp14 = tmp13.to(tl.float32)
    tmp15 = tmp12 / tmp14
    tmp16 = tmp8 - tmp15
    tmp17 = tmp16 * tmp16
    tmp18 = tl.broadcast_to(tmp17, [RBLOCK])
    tmp20 = triton_helpers.promote_to_tensor(tl.sum(tmp18, 0))
    tmp22 = tmp7 - tmp15
    tmp23 = 1024.0
    tmp24 = tmp20 / tmp23
    tmp25 = 1e-05
    tmp26 = tmp24 + tmp25
    tmp27 = libdevice.rsqrt(tmp26)
    tmp28 = tmp22 * tmp27
    tmp29 = tmp21 + tmp28
    tl.store(in_out_ptr0 + (r2 + 1024 * x3), tmp2, None)
    tl.store(in_out_ptr1 + (r2 + 1024 * x3), tmp29, None)
    tl.store(out_ptr2 + x3, tmp27, None)
    tl.store(out_ptr0 + x3, tmp15, None)


@triton.jit
def triton_poi_fused_reflection_pad2d_19(in_ptr0, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 295936
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 34
    x1 = xindex // 34 % 34
    x2 = xindex // 1156
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (1023 + -1 * tl_math.abs(-31 + tl_math.abs(-1 +
        x0)) + -32 * tl_math.abs(-31 + tl_math.abs(-1 + x1)) + 1024 * x2),
        xmask, eviction_policy='evict_last')
    tl.store(out_ptr0 + x3, tmp0, xmask)


@triton.jit
def triton_poi_fused__softmax_convolution_20(in_ptr0, in_ptr1, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex % 1024
    x1 = xindex // 1024
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 5120 * x1), None)
    tmp1 = tl.load(in_ptr1 + 0)
    tmp2 = tl.broadcast_to(tmp1, [XBLOCK])
    tmp4 = tl.load(in_ptr0 + (1024 + x0 + 5120 * x1), None)
    tmp5 = tl.load(in_ptr1 + 1)
    tmp6 = tl.broadcast_to(tmp5, [XBLOCK])
    tmp9 = tl.load(in_ptr0 + (2048 + x0 + 5120 * x1), None)
    tmp10 = tl.load(in_ptr1 + 2)
    tmp11 = tl.broadcast_to(tmp10, [XBLOCK])
    tmp14 = tl.load(in_ptr0 + (3072 + x0 + 5120 * x1), None)
    tmp15 = tl.load(in_ptr1 + 3)
    tmp16 = tl.broadcast_to(tmp15, [XBLOCK])
    tmp19 = tl.load(in_ptr0 + (4096 + x0 + 5120 * x1), None)
    tmp20 = tl.load(in_ptr1 + 4)
    tmp21 = tl.broadcast_to(tmp20, [XBLOCK])
    tmp3 = tmp0 + tmp2
    tmp7 = tmp4 + tmp6
    tmp8 = triton_helpers.maximum(tmp3, tmp7)
    tmp12 = tmp9 + tmp11
    tmp13 = triton_helpers.maximum(tmp8, tmp12)
    tmp17 = tmp14 + tmp16
    tmp18 = triton_helpers.maximum(tmp13, tmp17)
    tmp22 = tmp19 + tmp21
    tmp23 = triton_helpers.maximum(tmp18, tmp22)
    tmp24 = tmp3 - tmp23
    tmp25 = tl_math.exp(tmp24)
    tmp26 = tmp7 - tmp23
    tmp27 = tl_math.exp(tmp26)
    tmp28 = tmp25 + tmp27
    tmp29 = tmp12 - tmp23
    tmp30 = tl_math.exp(tmp29)
    tmp31 = tmp28 + tmp30
    tmp32 = tmp17 - tmp23
    tmp33 = tl_math.exp(tmp32)
    tmp34 = tmp31 + tmp33
    tmp35 = tmp22 - tmp23
    tmp36 = tl_math.exp(tmp35)
    tmp37 = tmp34 + tmp36
    tl.store(out_ptr0 + x2, tmp23, None)
    tl.store(out_ptr1 + x2, tmp37, None)


@triton.jit
def triton_poi_fused__softmax_convolution_21(in_out_ptr0, 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 // 1024 % 5
    x0 = xindex % 1024
    x2 = xindex // 5120
    tmp0 = tl.load(in_out_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr1 + (x0 + 1024 * x2), None, eviction_policy=
        'evict_last')
    tmp6 = tl.load(in_ptr2 + (x0 + 1024 * x2), None, eviction_policy=
        'evict_last')
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 - tmp3
    tmp5 = tl_math.exp(tmp4)
    tmp7 = tmp5 / tmp6
    tl.store(in_out_ptr0 + x3, tmp7, None)


@triton.jit
def triton_poi_fused_convolution_22(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 // 1024 % 5
    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_mul_sum_23(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)
    x0 = xindex % 1024
    x1 = xindex // 1024
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 5120 * x1), None)
    tmp1 = tl.load(in_ptr1 + (x0 + 5120 * x1), None)
    tmp3 = tl.load(in_ptr0 + (1024 + x0 + 5120 * x1), None)
    tmp4 = tl.load(in_ptr1 + (1024 + x0 + 5120 * x1), None)
    tmp7 = tl.load(in_ptr0 + (2048 + x0 + 5120 * x1), None)
    tmp8 = tl.load(in_ptr1 + (2048 + x0 + 5120 * x1), None)
    tmp11 = tl.load(in_ptr0 + (3072 + x0 + 5120 * x1), None)
    tmp12 = tl.load(in_ptr1 + (3072 + x0 + 5120 * x1), None)
    tmp15 = tl.load(in_ptr0 + (4096 + x0 + 5120 * x1), None)
    tmp16 = tl.load(in_ptr1 + (4096 + x0 + 5120 * x1), None)
    tmp2 = tmp0 * tmp1
    tmp5 = tmp3 * tmp4
    tmp6 = tmp2 + tmp5
    tmp9 = tmp7 * tmp8
    tmp10 = tmp6 + tmp9
    tmp13 = tmp11 * tmp12
    tmp14 = tmp10 + tmp13
    tmp17 = tmp15 * tmp16
    tmp18 = tmp14 + tmp17
    tl.store(out_ptr0 + x2, tmp18, None)


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) = args
    args.clear()
    assert_size_stride(primals_1, (4, 512, 4, 4), (8192, 16, 4, 1))
    assert_size_stride(primals_2, (256, 512, 1, 1), (512, 1, 1, 1))
    assert_size_stride(primals_3, (256, 512, 3, 3), (4608, 9, 3, 1))
    assert_size_stride(primals_4, (256,), (1,))
    assert_size_stride(primals_5, (256, 256, 3, 3), (2304, 9, 3, 1))
    assert_size_stride(primals_6, (256,), (1,))
    assert_size_stride(primals_7, (128, 256, 1, 1), (256, 1, 1, 1))
    assert_size_stride(primals_8, (128, 256, 3, 3), (2304, 9, 3, 1))
    assert_size_stride(primals_9, (128,), (1,))
    assert_size_stride(primals_10, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_11, (128,), (1,))
    assert_size_stride(primals_12, (64, 128, 1, 1), (128, 1, 1, 1))
    assert_size_stride(primals_13, (64, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_14, (64,), (1,))
    assert_size_stride(primals_15, (64, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_16, (64,), (1,))
    assert_size_stride(primals_17, (64, 64, 1, 1), (64, 1, 1, 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, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_21, (64,), (1,))
    assert_size_stride(primals_22, (5, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_23, (5,), (1,))
    assert_size_stride(primals_24, (5, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_25, (5,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 512, 8, 8), (32768, 64, 8, 1), torch.
            float32)
        buf1 = buf0
        del buf0
        buf2 = buf1
        del buf1
        get_raw_stream(0)
        triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_mul_sub_0[grid
            (131072)](buf2, primals_1, 131072, XBLOCK=512, num_warps=8,
            num_stages=1)
        del primals_1
        buf3 = extern_kernels.convolution(buf2, primals_2, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf3, (4, 256, 8, 8), (16384, 64, 8, 1))
        buf4 = empty_strided_cuda((4, 512, 10, 10), (51200, 100, 10, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_1[grid(204800)](buf2, buf4, 
            204800, XBLOCK=512, num_warps=8, num_stages=1)
        buf5 = extern_kernels.convolution(buf4, primals_3, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf5, (4, 256, 8, 8), (16384, 64, 8, 1))
        buf6 = buf5
        del buf5
        buf7 = empty_strided_cuda((1, 1024, 1, 1), (1024, 1, 1024, 1024),
            torch.float32)
        buf8 = empty_strided_cuda((1, 1024, 1, 1), (1024, 1, 1024, 1024),
            torch.float32)
        buf10 = empty_strided_cuda((1, 1024, 1, 1), (1024, 1, 1024, 1024),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_2[grid(1024)](
            buf6, primals_4, buf7, buf8, buf10, 1024, 64, XBLOCK=8,
            num_warps=4, num_stages=1)
        del primals_4
        buf11 = empty_strided_cuda((4, 256, 10, 10), (25600, 100, 10, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_3[grid(102400)](buf6, buf7, buf8,
            buf11, 102400, XBLOCK=512, num_warps=8, num_stages=1)
        buf12 = extern_kernels.convolution(buf11, primals_5, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf12, (4, 256, 8, 8), (16384, 64, 8, 1))
        buf13 = buf12
        del buf12
        buf14 = buf8
        del buf8
        buf15 = empty_strided_cuda((1, 1024, 1, 1), (1024, 1, 1024, 1024),
            torch.float32)
        buf17 = empty_strided_cuda((1, 1024, 1, 1), (1024, 1, 1024, 1024),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_2[grid(1024)](
            buf13, primals_6, buf14, buf15, buf17, 1024, 64, XBLOCK=8,
            num_warps=4, num_stages=1)
        del primals_6
        buf18 = empty_strided_cuda((16, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_4[grid(16)](buf18, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf19 = empty_strided_cuda((16, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_5[grid(16)](buf19, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf20 = empty_strided_cuda((16,), (1,), torch.int64)
        triton_poi_fused__to_copy_4[grid(16)](buf20, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf21 = empty_strided_cuda((16,), (1,), torch.int64)
        triton_poi_fused_add_clamp_5[grid(16)](buf21, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf24 = empty_strided_cuda((16,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_6[grid(16)](buf24,
            16, XBLOCK=16, num_warps=1, num_stages=1)
        buf26 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_6[grid(16)](buf26,
            16, XBLOCK=16, num_warps=1, num_stages=1)
        buf23 = empty_strided_cuda((4, 256, 16, 16), (65536, 256, 16, 1),
            torch.float32)
        buf27 = buf23
        del buf23
        buf28 = buf27
        del buf27
        triton_poi_fused__unsafe_index_add_mul_sub_7[grid(262144)](buf28,
            buf19, buf20, buf3, buf13, buf14, buf15, buf18, buf21, buf24,
            buf26, 262144, XBLOCK=512, num_warps=8, num_stages=1)
        del buf15
        del buf3
        buf29 = extern_kernels.convolution(buf28, primals_7, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf29, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf30 = empty_strided_cuda((4, 256, 18, 18), (82944, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_8[grid(331776)](buf28, buf30, 
            331776, XBLOCK=512, num_warps=8, num_stages=1)
        buf31 = extern_kernels.convolution(buf30, primals_8, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf31, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf32 = buf31
        del buf31
        buf33 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf34 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf36 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_9[grid(512)](
            buf32, primals_9, buf33, buf34, buf36, 512, 256, num_warps=2,
            num_stages=1)
        del primals_9
        buf37 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_10[grid(165888)](buf32, buf33,
            buf34, buf37, 165888, XBLOCK=1024, num_warps=4, num_stages=1)
        buf38 = extern_kernels.convolution(buf37, primals_10, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf38, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf39 = buf38
        del buf38
        buf40 = buf34
        del buf34
        buf41 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf43 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_9[grid(512)](
            buf39, primals_11, buf40, buf41, buf43, 512, 256, num_warps=2,
            num_stages=1)
        del primals_11
        buf44 = empty_strided_cuda((32, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_11[grid(32)](buf44, 32, XBLOCK=32,
            num_warps=1, num_stages=1)
        buf45 = empty_strided_cuda((32, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_12[grid(32)](buf45, 32, XBLOCK=32,
            num_warps=1, num_stages=1)
        buf46 = empty_strided_cuda((32,), (1,), torch.int64)
        triton_poi_fused__to_copy_11[grid(32)](buf46, 32, XBLOCK=32,
            num_warps=1, num_stages=1)
        buf47 = empty_strided_cuda((32,), (1,), torch.int64)
        triton_poi_fused_add_clamp_12[grid(32)](buf47, 32, XBLOCK=32,
            num_warps=1, num_stages=1)
        buf50 = empty_strided_cuda((32,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_13[grid(32)](buf50,
            32, XBLOCK=32, num_warps=1, num_stages=1)
        buf52 = empty_strided_cuda((32, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_13[grid(32)](buf52,
            32, XBLOCK=32, num_warps=1, num_stages=1)
        buf49 = empty_strided_cuda((4, 128, 32, 32), (131072, 1024, 32, 1),
            torch.float32)
        buf53 = buf49
        del buf49
        buf54 = buf53
        del buf53
        triton_poi_fused__unsafe_index_add_mul_sub_14[grid(524288)](buf54,
            buf45, buf46, buf29, buf39, buf40, buf41, buf44, buf47, buf50,
            buf52, 524288, XBLOCK=512, num_warps=8, num_stages=1)
        del buf29
        del buf41
        buf55 = extern_kernels.convolution(buf54, primals_12, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf55, (4, 64, 32, 32), (65536, 1024, 32, 1))
        buf56 = empty_strided_cuda((4, 128, 34, 34), (147968, 1156, 34, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_15[grid(591872)](buf54, buf56, 
            591872, XBLOCK=512, num_warps=8, num_stages=1)
        buf57 = extern_kernels.convolution(buf56, primals_13, 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, 32, 32), (65536, 1024, 32, 1))
        buf58 = buf57
        del buf57
        buf59 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf60 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf62 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_16[grid(256)](
            buf58, primals_14, buf59, buf60, buf62, 256, 1024, num_warps=8,
            num_stages=1)
        del primals_14
        buf63 = empty_strided_cuda((4, 64, 34, 34), (73984, 1156, 34, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_17[grid(295936)](buf58, buf59,
            buf60, buf63, 295936, XBLOCK=1024, num_warps=4, num_stages=1)
        buf64 = extern_kernels.convolution(buf63, primals_15, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf64, (4, 64, 32, 32), (65536, 1024, 32, 1))
        buf65 = buf64
        del buf64
        buf66 = buf60
        del buf60
        buf70 = buf55
        del buf55
        buf69 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_add_convolution_18[grid(256)
            ](buf65, buf70, primals_16, buf66, buf69, 256, 1024, num_warps=
            8, num_stages=1)
        del primals_16
        buf71 = extern_kernels.convolution(buf70, primals_17, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf71, (4, 64, 32, 32), (65536, 1024, 32, 1))
        buf72 = empty_strided_cuda((4, 64, 34, 34), (73984, 1156, 34, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_19[grid(295936)](buf70, buf72, 
            295936, XBLOCK=512, num_warps=8, num_stages=1)
        buf73 = extern_kernels.convolution(buf72, primals_18, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf73, (4, 64, 32, 32), (65536, 1024, 32, 1))
        buf74 = buf73
        del buf73
        buf75 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf76 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf78 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_16[grid(256)](
            buf74, primals_19, buf75, buf76, buf78, 256, 1024, num_warps=8,
            num_stages=1)
        del primals_19
        buf79 = empty_strided_cuda((4, 64, 34, 34), (73984, 1156, 34, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_17[grid(295936)](buf74, buf75,
            buf76, buf79, 295936, XBLOCK=1024, num_warps=4, num_stages=1)
        buf80 = extern_kernels.convolution(buf79, primals_20, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf80, (4, 64, 32, 32), (65536, 1024, 32, 1))
        buf81 = buf80
        del buf80
        buf82 = buf76
        del buf76
        buf86 = buf71
        del buf71
        buf85 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_add_convolution_18[grid(256)
            ](buf81, buf86, primals_21, buf82, buf85, 256, 1024, num_warps=
            8, num_stages=1)
        del primals_21
        buf87 = extern_kernels.convolution(buf86, primals_22, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf87, (4, 5, 32, 32), (5120, 1024, 32, 1))
        buf88 = empty_strided_cuda((4, 1, 32, 32), (1024, 4096, 32, 1),
            torch.float32)
        buf89 = empty_strided_cuda((4, 1, 32, 32), (1024, 4096, 32, 1),
            torch.float32)
        triton_poi_fused__softmax_convolution_20[grid(4096)](buf87,
            primals_23, buf88, buf89, 4096, XBLOCK=256, num_warps=4,
            num_stages=1)
        buf90 = buf87
        del buf87
        triton_poi_fused__softmax_convolution_21[grid(20480)](buf90,
            primals_23, buf88, buf89, 20480, XBLOCK=256, num_warps=4,
            num_stages=1)
        del buf88
        del primals_23
        buf91 = extern_kernels.convolution(buf86, primals_24, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf91, (4, 5, 32, 32), (5120, 1024, 32, 1))
        buf92 = buf91
        del buf91
        triton_poi_fused_convolution_22[grid(20480)](buf92, primals_25, 
            20480, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_25
        buf93 = reinterpret_tensor(buf89, (4, 32, 32), (1024, 32, 1), 0)
        del buf89
        triton_poi_fused_mul_sum_23[grid(4096)](buf92, buf90, buf93, 4096,
            XBLOCK=256, num_warps=4, num_stages=1)
    return (reinterpret_tensor(buf93, (4, 1, 32, 32), (1024, 1024, 32, 1), 
        0), primals_2, primals_3, primals_5, primals_7, primals_8,
        primals_10, primals_12, primals_13, primals_15, primals_17,
        primals_18, primals_20, primals_22, primals_24, buf2, buf4, buf6,
        reinterpret_tensor(buf10, (1024,), (1,), 0), buf11, buf13,
        reinterpret_tensor(buf17, (1024,), (1,), 0), buf18, buf19, buf20,
        buf21, buf24, buf26, buf28, buf30, buf32, reinterpret_tensor(buf36,
        (512,), (1,), 0), buf37, buf39, reinterpret_tensor(buf43, (512,), (
        1,), 0), buf44, buf45, buf46, buf47, buf50, buf52, buf54, buf56,
        buf58, reinterpret_tensor(buf62, (256,), (1,), 0), buf63, buf65,
        reinterpret_tensor(buf69, (256,), (1,), 0), buf70, buf72, buf74,
        reinterpret_tensor(buf78, (256,), (1,), 0), buf79, buf81,
        reinterpret_tensor(buf85, (256,), (1,), 0), buf86, buf90, buf92,
        reinterpret_tensor(buf82, (1, 256, 1, 1), (256, 1, 1, 1), 0),
        reinterpret_tensor(buf75, (1, 256, 1, 1), (256, 1, 1, 1), 0),
        reinterpret_tensor(buf66, (1, 256, 1, 1), (256, 1, 1, 1), 0),
        reinterpret_tensor(buf59, (1, 256, 1, 1), (256, 1, 1, 1), 0),
        reinterpret_tensor(buf40, (1, 512, 1, 1), (512, 1, 1, 1), 0),
        reinterpret_tensor(buf33, (1, 512, 1, 1), (512, 1, 1, 1), 0),
        reinterpret_tensor(buf14, (1, 1024, 1, 1), (1024, 1, 1, 1), 0),
        reinterpret_tensor(buf7, (1, 1024, 1, 1), (1024, 1, 1, 1), 0))


class ResidualBlock(nn.Module):

    def __init__(self, input_channel, output_channel, upsample=True):
        super(ResidualBlock, self).__init__()
        self.conv1 = nn.Conv2d(input_channel, output_channel, kernel_size=3,
            padding=0)
        self.conv2 = nn.Conv2d(output_channel, output_channel, kernel_size=
            3, padding=0)
        self.conv_shortcut = nn.Conv2d(input_channel, output_channel,
            kernel_size=1, bias=False)
        self.relu = nn.LeakyReLU(0.2)
        self.norm = nn.InstanceNorm2d(output_channel)
        self.upsample = upsample
        self.reflecPad1 = nn.ReflectionPad2d((1, 1, 1, 1))
        self.reflecPad2 = nn.ReflectionPad2d((1, 1, 1, 1))

    def forward(self, x):
        if self.upsample:
            x = F.interpolate(x, mode='bilinear', scale_factor=2)
        x_s = self.conv_shortcut(x)
        x = self.conv1(self.reflecPad1(x))
        x = self.relu(x)
        x = self.norm(x)
        x = self.conv2(self.reflecPad2(x))
        x = self.relu(x)
        x = self.norm(x)
        return x_s + x


class Img_decoder_v3New(nn.Module):

    def __init__(self):
        super(Img_decoder_v3New, self).__init__()
        self.slice4 = ResidualBlock(512, 256)
        self.slice3 = ResidualBlock(256, 128)
        self.slice2 = ResidualBlock(128, 64)
        self.slice1 = ResidualBlock(64, 64, upsample=False)
        self.map = nn.Conv2d(64, 5, 3, 1, 1)
        self.confidence = nn.Conv2d(64, 5, 3, 1, 1)
        self.soft = nn.Softmax(dim=1)

    def forward(self, input_0):
        primals_3 = self.slice4.conv1.weight
        primals_4 = self.slice4.conv1.bias
        primals_5 = self.slice4.conv2.weight
        primals_6 = self.slice4.conv2.bias
        primals_2 = self.slice4.conv_shortcut.weight
        primals_8 = self.slice3.conv1.weight
        primals_9 = self.slice3.conv1.bias
        primals_10 = self.slice3.conv2.weight
        primals_11 = self.slice3.conv2.bias
        primals_7 = self.slice3.conv_shortcut.weight
        primals_13 = self.slice2.conv1.weight
        primals_14 = self.slice2.conv1.bias
        primals_15 = self.slice2.conv2.weight
        primals_16 = self.slice2.conv2.bias
        primals_12 = self.slice2.conv_shortcut.weight
        primals_18 = self.slice1.conv1.weight
        primals_19 = self.slice1.conv1.bias
        primals_20 = self.slice1.conv2.weight
        primals_21 = self.slice1.conv2.bias
        primals_17 = self.slice1.conv_shortcut.weight
        primals_22 = self.map.weight
        primals_23 = self.map.bias
        primals_24 = self.confidence.weight
        primals_25 = self.confidence.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])
        return output[0]


Measured latency_ms: 0.071396