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 numpy as np
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_reflection_pad2d_0(in_ptr0, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 62208
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 72
    x1 = xindex // 72 % 72
    x2 = xindex // 5184
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (4095 + -1 * tl_math.abs(-63 + tl_math.abs(-4 +
        x0)) + -64 * tl_math.abs(-63 + tl_math.abs(-4 + x1)) + 4096 * x2),
        xmask, eviction_policy='evict_last')
    tl.store(out_ptr0 + x3, tmp0, xmask)


@triton.jit
def triton_red_fused__native_batch_norm_legit_convolution_1(in_out_ptr0,
    in_out_ptr1, in_ptr0, out_ptr0, xnumel, rnumel, XBLOCK: tl.constexpr,
    RBLOCK: tl.constexpr):
    xnumel = 192
    rnumel = 4096
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rbase = tl.arange(0, RBLOCK)[None, :]
    x3 = xindex
    x0 = xindex % 48
    tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')
    tmp4_mean = tl.zeros([XBLOCK, RBLOCK], tl.float32)
    tmp4_m2 = tl.zeros([XBLOCK, RBLOCK], tl.float32)
    tmp4_weight = tl.zeros([XBLOCK, RBLOCK], tl.float32)
    for roffset in range(0, rnumel, RBLOCK):
        rindex = roffset + rbase
        rmask = rindex < rnumel
        r2 = rindex
        tmp0 = tl.load(in_out_ptr0 + (r2 + 4096 * x3), rmask & xmask,
            eviction_policy='evict_first', other=0.0)
        tmp2 = tmp0 + tmp1
        tmp3 = tl.broadcast_to(tmp2, [XBLOCK, RBLOCK])
        tmp4_mean_next, tmp4_m2_next, tmp4_weight_next = (triton_helpers.
            welford_reduce(tmp3, tmp4_mean, tmp4_m2, tmp4_weight, roffset == 0)
            )
        tmp4_mean = tl.where(rmask & xmask, tmp4_mean_next, tmp4_mean)
        tmp4_m2 = tl.where(rmask & xmask, tmp4_m2_next, tmp4_m2)
        tmp4_weight = tl.where(rmask & xmask, tmp4_weight_next, tmp4_weight)
        tl.store(in_out_ptr0 + (r2 + 4096 * x3), tmp2, rmask & xmask)
    tmp4_tmp, tmp5_tmp, tmp6_tmp = triton_helpers.welford(tmp4_mean,
        tmp4_m2, tmp4_weight, 1)
    tmp4 = tmp4_tmp[:, None]
    tmp5 = tmp5_tmp[:, None]
    tmp6_tmp[:, None]
    tl.store(out_ptr0 + x3, tmp4, xmask)
    tmp7 = 4096.0
    tmp8 = tmp5 / tmp7
    tmp9 = 1e-05
    tmp10 = tmp8 + tmp9
    tmp11 = libdevice.rsqrt(tmp10)
    tl.debug_barrier()
    tl.store(in_out_ptr1 + x3, tmp11, xmask)


@triton.jit
def triton_poi_fused_repeat_2(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 192
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0 % 48, xmask)
    tl.store(out_ptr0 + x0, tmp0, xmask)


@triton.jit
def triton_poi_fused_reflection_pad2d_relu_3(in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, in_ptr4, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 836352
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 66
    x1 = xindex // 66 % 66
    x2 = xindex // 4356
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (4095 + -1 * tl_math.abs(-63 + tl_math.abs(-1 +
        x0)) + -64 * tl_math.abs(-63 + tl_math.abs(-1 + x1)) + 4096 * x2),
        xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x2, xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr3 + x2, xmask, eviction_policy='evict_last')
    tmp7 = tl.load(in_ptr4 + x2, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp6 = tmp4 * tmp5
    tmp8 = tmp6 + tmp7
    tmp9 = tl.full([1], 0, tl.int32)
    tmp10 = triton_helpers.maximum(tmp9, tmp8)
    tl.store(out_ptr0 + x3, tmp10, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_4(in_out_ptr0,
    in_out_ptr1, in_ptr0, out_ptr0, 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 % 96
    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 = tl.broadcast_to(tmp2, [RBLOCK])
    tmp5 = tl.broadcast_to(tmp3, [RBLOCK])
    tmp7 = triton_helpers.promote_to_tensor(tl.sum(tmp5, 0))
    tmp8 = tl.full([1], 1024, tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 / tmp9
    tmp11 = tmp3 - tmp10
    tmp12 = tmp11 * tmp11
    tmp13 = tl.broadcast_to(tmp12, [RBLOCK])
    tmp15 = triton_helpers.promote_to_tensor(tl.sum(tmp13, 0))
    tmp16 = 1024.0
    tmp17 = tmp15 / tmp16
    tmp18 = 1e-05
    tmp19 = tmp17 + tmp18
    tmp20 = libdevice.rsqrt(tmp19)
    tl.store(in_out_ptr0 + (r2 + 1024 * x3), tmp2, None)
    tl.debug_barrier()
    tl.store(in_out_ptr1 + x3, tmp20, None)
    tl.store(out_ptr0 + x3, tmp10, None)


@triton.jit
def triton_poi_fused_repeat_5(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 384
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0 % 96, xmask)
    tl.store(out_ptr0 + x0, tmp0, xmask)


@triton.jit
def triton_poi_fused_reflection_pad2d_relu_6(in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, in_ptr4, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 443904
    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')
    tmp1 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x2, xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr3 + x2, xmask, eviction_policy='evict_last')
    tmp7 = tl.load(in_ptr4 + x2, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp6 = tmp4 * tmp5
    tmp8 = tmp6 + tmp7
    tmp9 = tl.full([1], 0, tl.int32)
    tmp10 = triton_helpers.maximum(tmp9, tmp8)
    tl.store(out_ptr0 + x3, tmp10, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_relu_repeat_7(
    in_out_ptr0, in_out_ptr1, in_ptr0, in_ptr1, in_ptr2, out_ptr0, out_ptr1,
    out_ptr2, out_ptr3, 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)
    x0 = xindex
    r3 = rindex
    x1 = xindex % 192
    tmp0 = tl.load(in_ptr0 + x0 % 192, None, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x0 % 192, None, eviction_policy='evict_last')
    tmp2 = tl.load(in_out_ptr0 + (r3 + 256 * x0), None)
    tmp3 = tl.load(in_ptr2 + x1, None, eviction_policy='evict_last')
    tmp4 = tmp2 + tmp3
    tmp5 = tl.broadcast_to(tmp4, [RBLOCK])
    tmp7 = tl.broadcast_to(tmp5, [RBLOCK])
    tmp9 = triton_helpers.promote_to_tensor(tl.sum(tmp7, 0))
    tmp10 = tl.full([1], 256, tl.int32)
    tmp11 = tmp10.to(tl.float32)
    tmp12 = tmp9 / tmp11
    tmp13 = tmp5 - tmp12
    tmp14 = tmp13 * tmp13
    tmp15 = tl.broadcast_to(tmp14, [RBLOCK])
    tmp17 = triton_helpers.promote_to_tensor(tl.sum(tmp15, 0))
    tmp18 = 256.0
    tmp19 = tmp17 / tmp18
    tmp20 = 1e-05
    tmp21 = tmp19 + tmp20
    tmp22 = libdevice.rsqrt(tmp21)
    tmp23 = tmp4 - tmp12
    tmp24 = tmp23 * tmp22
    tmp25 = tmp24 * tmp0
    tmp26 = tmp25 + tmp1
    tmp27 = tl.full([1], 0, tl.int32)
    tmp28 = triton_helpers.maximum(tmp27, tmp26)
    tl.store(out_ptr0 + x0, tmp0, None)
    tl.store(out_ptr1 + x0, tmp1, None)
    tl.store(in_out_ptr0 + (r3 + 256 * x0), tmp4, None)
    tl.debug_barrier()
    tl.store(in_out_ptr1 + x0, tmp22, None)
    tl.store(out_ptr3 + (r3 + 256 * x0), tmp28, None)
    tl.store(out_ptr2 + x0, tmp12, None)


@triton.jit
def triton_poi_fused_reflection_pad2d_8(in_ptr0, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 248832
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    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),
        xmask, eviction_policy='evict_last')
    tl.store(out_ptr0 + x3, tmp0, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_9(in_out_ptr0,
    in_out_ptr1, in_ptr0, out_ptr0, 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 % 192
    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 = tl.broadcast_to(tmp2, [RBLOCK])
    tmp5 = tl.broadcast_to(tmp3, [RBLOCK])
    tmp7 = triton_helpers.promote_to_tensor(tl.sum(tmp5, 0))
    tmp8 = tl.full([1], 256, tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 / tmp9
    tmp11 = tmp3 - tmp10
    tmp12 = tmp11 * tmp11
    tmp13 = tl.broadcast_to(tmp12, [RBLOCK])
    tmp15 = triton_helpers.promote_to_tensor(tl.sum(tmp13, 0))
    tmp16 = 256.0
    tmp17 = tmp15 / tmp16
    tmp18 = 1e-05
    tmp19 = tmp17 + tmp18
    tmp20 = libdevice.rsqrt(tmp19)
    tl.store(in_out_ptr0 + (r2 + 256 * x3), tmp2, None)
    tl.debug_barrier()
    tl.store(in_out_ptr1 + x3, tmp20, None)
    tl.store(out_ptr0 + x3, tmp10, None)


@triton.jit
def triton_poi_fused_repeat_10(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 768
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0 % 192, xmask)
    tl.store(out_ptr0 + x0, tmp0, xmask)


@triton.jit
def triton_poi_fused_reflection_pad2d_relu_11(in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, in_ptr4, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 248832
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    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),
        xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x2, xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr3 + x2, xmask, eviction_policy='evict_last')
    tmp7 = tl.load(in_ptr4 + x2, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp6 = tmp4 * tmp5
    tmp8 = tmp6 + tmp7
    tmp9 = tl.full([1], 0, tl.int32)
    tmp10 = triton_helpers.maximum(tmp9, tmp8)
    tl.store(out_ptr0 + x3, tmp10, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_add_convolution_repeat_12(
    in_out_ptr0, in_out_ptr1, in_ptr0, in_ptr1, in_ptr2, out_ptr0, out_ptr1,
    out_ptr3, 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)
    x0 = xindex
    r3 = rindex
    x1 = xindex % 192
    tmp0 = tl.load(in_ptr0 + x0 % 192, None, eviction_policy='evict_last')
    tmp1 = tl.load(in_out_ptr0 + (r3 + 256 * x0), None)
    tmp2 = tl.load(in_ptr1 + x1, None, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr2 + x1, None, eviction_policy='evict_last')
    tmp27 = tl.load(in_out_ptr1 + (r3 + 256 * x0), None)
    tmp3 = tmp1 + tmp2
    tmp4 = tl.broadcast_to(tmp3, [RBLOCK])
    tmp6 = tl.broadcast_to(tmp4, [RBLOCK])
    tmp8 = triton_helpers.promote_to_tensor(tl.sum(tmp6, 0))
    tmp9 = tl.full([1], 256, tl.int32)
    tmp10 = tmp9.to(tl.float32)
    tmp11 = tmp8 / tmp10
    tmp12 = tmp4 - tmp11
    tmp13 = tmp12 * tmp12
    tmp14 = tl.broadcast_to(tmp13, [RBLOCK])
    tmp16 = triton_helpers.promote_to_tensor(tl.sum(tmp14, 0))
    tmp17 = tmp3 - tmp11
    tmp18 = 256.0
    tmp19 = tmp16 / tmp18
    tmp20 = 1e-05
    tmp21 = tmp19 + tmp20
    tmp22 = libdevice.rsqrt(tmp21)
    tmp23 = tmp17 * tmp22
    tmp24 = tmp23 * tmp0
    tmp26 = tmp24 + tmp25
    tmp28 = tmp26 + tmp27
    tl.store(out_ptr0 + x0, tmp0, None)
    tl.store(in_out_ptr0 + (r3 + 256 * x0), tmp3, None)
    tl.store(in_out_ptr1 + (r3 + 256 * x0), tmp28, None)
    tl.store(out_ptr3 + x0, tmp22, None)
    tl.store(out_ptr1 + x0, tmp11, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_13(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 % 192
    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 = tl.broadcast_to(tmp2, [RBLOCK])
    tmp5 = tl.broadcast_to(tmp3, [RBLOCK])
    tmp7 = triton_helpers.promote_to_tensor(tl.sum(tmp5, 0))
    tmp8 = tl.full([1], 256, tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 / tmp9
    tmp11 = tmp3 - tmp10
    tmp12 = tmp11 * tmp11
    tmp13 = tl.broadcast_to(tmp12, [RBLOCK])
    tmp15 = triton_helpers.promote_to_tensor(tl.sum(tmp13, 0))
    tmp16 = 256.0
    tmp17 = tmp15 / tmp16
    tmp18 = 1e-05
    tmp19 = tmp17 + tmp18
    tmp20 = libdevice.rsqrt(tmp19)
    tl.store(in_out_ptr0 + (r2 + 256 * x3), tmp2, None)
    tl.store(out_ptr2 + x3, tmp20, None)
    tl.store(out_ptr0 + x3, tmp10, None)
    tl.store(out_ptr1 + x3, tmp15, None)


@triton.jit
def triton_poi_fused__to_copy_add_arange_mul_14(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.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp4, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_add_reflection_pad2d_15(in_ptr0, in_ptr1,
    in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 887808
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 34 % 34
    x0 = xindex % 34
    x4 = xindex // 1156
    x2 = xindex // 1156 % 192
    x7 = xindex
    tmp0 = tl.load(in_ptr0 + (31 + -1 * tl_math.abs(-31 + tl_math.abs(-1 +
        x1))), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (31 + -1 * tl_math.abs(-31 + tl_math.abs(-1 +
        x0))), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr2 + x4, xmask, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr3 + x4, xmask, eviction_policy='evict_last')
    tmp19 = tl.load(in_ptr4 + x4, xmask, eviction_policy='evict_last')
    tmp21 = tl.load(in_ptr5 + x2, xmask, 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_ptr1 + (tmp8 + 16 * tmp4 + 256 * x4), xmask,
        eviction_policy='evict_last')
    tmp11 = tmp9 - tmp10
    tmp13 = 256.0
    tmp14 = tmp12 / tmp13
    tmp15 = 1e-05
    tmp16 = tmp14 + tmp15
    tmp17 = libdevice.rsqrt(tmp16)
    tmp18 = tmp11 * tmp17
    tmp20 = tmp18 * tmp19
    tmp22 = tmp20 + tmp21
    tmp23 = tl.load(in_ptr6 + (tmp8 + 16 * tmp4 + 256 * x4), xmask,
        eviction_policy='evict_last')
    tmp24 = tmp22 + tmp23
    tl.store(out_ptr0 + x7, tmp24, xmask)


@triton.jit
def triton_poi_fused__to_copy_add_arange_mul_16(out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 64
    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.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp4, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_reflection_pad2d_relu_17(in_ptr0,
    in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 1672704
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 66 % 66
    x0 = xindex % 66
    x2 = xindex // 4356
    x5 = xindex
    tmp0 = tl.load(in_ptr0 + (63 + -1 * tl_math.abs(-63 + tl_math.abs(-1 +
        x1))), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (63 + -1 * tl_math.abs(-63 + tl_math.abs(-1 +
        x0))), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr2 + x2, xmask, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr3 + x2, xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr4 + x2, xmask, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr5 + x2, xmask, eviction_policy='evict_last')
    tmp1 = tl.full([XBLOCK], 32, 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_ptr1 + (tmp8 + 32 * tmp4 + 1024 * x2), xmask,
        eviction_policy='evict_last')
    tmp11 = tmp9 - tmp10
    tmp13 = tmp11 * tmp12
    tmp15 = tmp13 * tmp14
    tmp17 = tmp15 + tmp16
    tmp18 = tl.full([1], 0, tl.int32)
    tmp19 = triton_helpers.maximum(tmp18, tmp17)
    tl.store(out_ptr0 + x5, tmp19, xmask)


@triton.jit
def triton_poi_fused_reflection_pad2d_relu_18(in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, in_ptr4, 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 % 72
    x1 = xindex // 72 % 72
    x2 = xindex // 5184
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (4095 + -1 * tl_math.abs(-63 + tl_math.abs(-4 +
        x0)) + -64 * tl_math.abs(-63 + tl_math.abs(-4 + x1)) + 4096 * x2),
        None, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x2, None, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x2, None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr3 + x2, None, eviction_policy='evict_last')
    tmp7 = tl.load(in_ptr4 + x2, None, eviction_policy='evict_last')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp6 = tmp4 * tmp5
    tmp8 = tmp6 + tmp7
    tmp9 = tl.full([1], 0, tl.int32)
    tmp10 = triton_helpers.maximum(tmp9, tmp8)
    tl.store(out_ptr0 + x3, tmp10, None)


@triton.jit
def triton_poi_fused_add_convolution_div_mul_tanh_19(in_out_ptr0, 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)
    x3 = xindex
    x1 = xindex // 4096 % 3
    tmp0 = tl.load(in_out_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.00392156862745098
    tmp4 = tmp2 * tmp3
    tmp5 = libdevice.tanh(tmp4)
    tmp6 = 150.0
    tmp7 = tmp5 * tmp6
    tmp8 = 127.5
    tmp9 = tmp7 + tmp8
    tl.store(in_out_ptr0 + x3, tmp2, None)
    tl.store(out_ptr0 + x3, tmp9, 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, primals_26, primals_27,
        primals_28, primals_29, primals_30, primals_31, primals_32,
        primals_33, primals_34, primals_35, primals_36, primals_37,
        primals_38, primals_39, primals_40, primals_41, primals_42,
        primals_43, primals_44, primals_45, primals_46, primals_47,
        primals_48, primals_49, primals_50, primals_51, primals_52,
        primals_53, primals_54, primals_55) = args
    args.clear()
    assert_size_stride(primals_1, (4, 3, 64, 64), (12288, 4096, 64, 1))
    assert_size_stride(primals_2, (48, 3, 9, 9), (243, 81, 9, 1))
    assert_size_stride(primals_3, (48,), (1,))
    assert_size_stride(primals_4, (48,), (1,))
    assert_size_stride(primals_5, (48,), (1,))
    assert_size_stride(primals_6, (96, 48, 3, 3), (432, 9, 3, 1))
    assert_size_stride(primals_7, (96,), (1,))
    assert_size_stride(primals_8, (96,), (1,))
    assert_size_stride(primals_9, (96,), (1,))
    assert_size_stride(primals_10, (192, 96, 3, 3), (864, 9, 3, 1))
    assert_size_stride(primals_11, (192,), (1,))
    assert_size_stride(primals_12, (192,), (1,))
    assert_size_stride(primals_13, (192,), (1,))
    assert_size_stride(primals_14, (192, 192, 3, 3), (1728, 9, 3, 1))
    assert_size_stride(primals_15, (192,), (1,))
    assert_size_stride(primals_16, (192,), (1,))
    assert_size_stride(primals_17, (192,), (1,))
    assert_size_stride(primals_18, (192, 192, 3, 3), (1728, 9, 3, 1))
    assert_size_stride(primals_19, (192,), (1,))
    assert_size_stride(primals_20, (192,), (1,))
    assert_size_stride(primals_21, (192,), (1,))
    assert_size_stride(primals_22, (192, 192, 3, 3), (1728, 9, 3, 1))
    assert_size_stride(primals_23, (192,), (1,))
    assert_size_stride(primals_24, (192,), (1,))
    assert_size_stride(primals_25, (192,), (1,))
    assert_size_stride(primals_26, (192, 192, 3, 3), (1728, 9, 3, 1))
    assert_size_stride(primals_27, (192,), (1,))
    assert_size_stride(primals_28, (192,), (1,))
    assert_size_stride(primals_29, (192,), (1,))
    assert_size_stride(primals_30, (192, 192, 3, 3), (1728, 9, 3, 1))
    assert_size_stride(primals_31, (192,), (1,))
    assert_size_stride(primals_32, (192,), (1,))
    assert_size_stride(primals_33, (192,), (1,))
    assert_size_stride(primals_34, (192, 192, 3, 3), (1728, 9, 3, 1))
    assert_size_stride(primals_35, (192,), (1,))
    assert_size_stride(primals_36, (192,), (1,))
    assert_size_stride(primals_37, (192,), (1,))
    assert_size_stride(primals_38, (192, 192, 3, 3), (1728, 9, 3, 1))
    assert_size_stride(primals_39, (192,), (1,))
    assert_size_stride(primals_40, (192,), (1,))
    assert_size_stride(primals_41, (192,), (1,))
    assert_size_stride(primals_42, (192, 192, 3, 3), (1728, 9, 3, 1))
    assert_size_stride(primals_43, (192,), (1,))
    assert_size_stride(primals_44, (192,), (1,))
    assert_size_stride(primals_45, (192,), (1,))
    assert_size_stride(primals_46, (96, 192, 3, 3), (1728, 9, 3, 1))
    assert_size_stride(primals_47, (96,), (1,))
    assert_size_stride(primals_48, (96,), (1,))
    assert_size_stride(primals_49, (96,), (1,))
    assert_size_stride(primals_50, (48, 96, 3, 3), (864, 9, 3, 1))
    assert_size_stride(primals_51, (48,), (1,))
    assert_size_stride(primals_52, (48,), (1,))
    assert_size_stride(primals_53, (48,), (1,))
    assert_size_stride(primals_54, (3, 48, 9, 9), (3888, 81, 9, 1))
    assert_size_stride(primals_55, (3,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 3, 72, 72), (15552, 5184, 72, 1),
            torch.float32)
        get_raw_stream(0)
        triton_poi_fused_reflection_pad2d_0[grid(62208)](primals_1, buf0, 
            62208, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_1
        buf1 = extern_kernels.convolution(buf0, primals_2, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf1, (4, 48, 64, 64), (196608, 4096, 64, 1))
        buf2 = buf1
        del buf1
        buf5 = empty_strided_cuda((1, 192, 1, 1), (192, 1, 1, 1), torch.float32
            )
        buf6 = empty_strided_cuda((1, 192, 1, 1), (192, 1, 192, 192), torch
            .float32)
        buf8 = reinterpret_tensor(buf6, (1, 192, 1, 1), (192, 1, 1, 1), 0)
        del buf6
        triton_red_fused__native_batch_norm_legit_convolution_1[grid(192)](buf2
            , buf8, primals_3, buf5, 192, 4096, XBLOCK=1, RBLOCK=2048,
            num_warps=16, num_stages=1)
        del primals_3
        buf3 = empty_strided_cuda((192,), (1,), torch.float32)
        triton_poi_fused_repeat_2[grid(192)](primals_4, buf3, 192, XBLOCK=
            256, num_warps=4, num_stages=1)
        del primals_4
        buf4 = empty_strided_cuda((192,), (1,), torch.float32)
        triton_poi_fused_repeat_2[grid(192)](primals_5, buf4, 192, XBLOCK=
            256, num_warps=4, num_stages=1)
        del primals_5
        buf9 = empty_strided_cuda((4, 48, 66, 66), (209088, 4356, 66, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_3[grid(836352)](buf2, buf5,
            buf8, buf3, buf4, buf9, 836352, XBLOCK=512, num_warps=8,
            num_stages=1)
        buf10 = extern_kernels.convolution(buf9, primals_6, stride=(2, 2),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf10, (4, 96, 32, 32), (98304, 1024, 32, 1))
        buf11 = buf10
        del buf10
        buf14 = empty_strided_cuda((1, 384, 1, 1), (384, 1, 1, 1), torch.
            float32)
        buf15 = empty_strided_cuda((1, 384, 1, 1), (384, 1, 384, 384),
            torch.float32)
        buf17 = reinterpret_tensor(buf15, (1, 384, 1, 1), (384, 1, 1, 1), 0)
        del buf15
        triton_per_fused__native_batch_norm_legit_convolution_4[grid(384)](
            buf11, buf17, primals_7, buf14, 384, 1024, num_warps=8,
            num_stages=1)
        del primals_7
        buf12 = empty_strided_cuda((384,), (1,), torch.float32)
        triton_poi_fused_repeat_5[grid(384)](primals_8, buf12, 384, XBLOCK=
            256, num_warps=4, num_stages=1)
        del primals_8
        buf13 = empty_strided_cuda((384,), (1,), torch.float32)
        triton_poi_fused_repeat_5[grid(384)](primals_9, buf13, 384, XBLOCK=
            256, num_warps=4, num_stages=1)
        del primals_9
        buf18 = empty_strided_cuda((4, 96, 34, 34), (110976, 1156, 34, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_6[grid(443904)](buf11, buf14,
            buf17, buf12, buf13, buf18, 443904, XBLOCK=1024, num_warps=4,
            num_stages=1)
        buf19 = extern_kernels.convolution(buf18, primals_10, stride=(2, 2),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf19, (4, 192, 16, 16), (49152, 256, 16, 1))
        buf21 = empty_strided_cuda((768,), (1,), torch.float32)
        buf22 = empty_strided_cuda((768,), (1,), torch.float32)
        buf20 = buf19
        del buf19
        buf23 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 1, 1), torch.
            float32)
        buf24 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf26 = reinterpret_tensor(buf24, (1, 768, 1, 1), (768, 1, 1, 1), 0)
        del buf24
        buf27 = empty_strided_cuda((4, 192, 16, 16), (49152, 256, 16, 1),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_relu_repeat_7[
            grid(768)](buf20, buf26, primals_12, primals_13, primals_11,
            buf21, buf22, buf23, buf27, 768, 256, num_warps=2, num_stages=1)
        del primals_11
        del primals_12
        del primals_13
        buf28 = empty_strided_cuda((4, 192, 18, 18), (62208, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_8[grid(248832)](buf27, buf28, 
            248832, XBLOCK=1024, num_warps=4, num_stages=1)
        buf29 = extern_kernels.convolution(buf28, primals_14, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf29, (4, 192, 16, 16), (49152, 256, 16, 1))
        buf30 = buf29
        del buf29
        buf33 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 1, 1), torch.
            float32)
        buf34 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf36 = reinterpret_tensor(buf34, (1, 768, 1, 1), (768, 1, 1, 1), 0)
        del buf34
        triton_per_fused__native_batch_norm_legit_convolution_9[grid(768)](
            buf30, buf36, primals_15, buf33, 768, 256, num_warps=2,
            num_stages=1)
        del primals_15
        buf31 = empty_strided_cuda((768,), (1,), torch.float32)
        triton_poi_fused_repeat_10[grid(768)](primals_16, buf31, 768,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_16
        buf32 = empty_strided_cuda((768,), (1,), torch.float32)
        triton_poi_fused_repeat_10[grid(768)](primals_17, buf32, 768,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_17
        buf37 = empty_strided_cuda((4, 192, 18, 18), (62208, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_11[grid(248832)](buf30,
            buf33, buf36, buf31, buf32, buf37, 248832, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf38 = extern_kernels.convolution(buf37, primals_18, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf38, (4, 192, 16, 16), (49152, 256, 16, 1))
        buf40 = empty_strided_cuda((768,), (1,), torch.float32)
        buf39 = buf38
        del buf38
        buf41 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf45 = buf27
        del buf27
        buf44 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_add_convolution_repeat_12[
            grid(768)](buf39, buf45, primals_20, primals_19, primals_21,
            buf40, buf41, buf44, 768, 256, num_warps=2, num_stages=1)
        del primals_19
        del primals_20
        del primals_21
        buf46 = empty_strided_cuda((4, 192, 18, 18), (62208, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_8[grid(248832)](buf45, buf46, 
            248832, XBLOCK=1024, num_warps=4, num_stages=1)
        buf47 = extern_kernels.convolution(buf46, primals_22, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf47, (4, 192, 16, 16), (49152, 256, 16, 1))
        buf48 = buf47
        del buf47
        buf51 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 1, 1), torch.
            float32)
        buf52 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf54 = reinterpret_tensor(buf52, (1, 768, 1, 1), (768, 1, 1, 1), 0)
        del buf52
        triton_per_fused__native_batch_norm_legit_convolution_9[grid(768)](
            buf48, buf54, primals_23, buf51, 768, 256, num_warps=2,
            num_stages=1)
        del primals_23
        buf49 = empty_strided_cuda((768,), (1,), torch.float32)
        triton_poi_fused_repeat_10[grid(768)](primals_24, buf49, 768,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_24
        buf50 = empty_strided_cuda((768,), (1,), torch.float32)
        triton_poi_fused_repeat_10[grid(768)](primals_25, buf50, 768,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_25
        buf55 = empty_strided_cuda((4, 192, 18, 18), (62208, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_11[grid(248832)](buf48,
            buf51, buf54, buf49, buf50, buf55, 248832, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf56 = extern_kernels.convolution(buf55, primals_26, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf56, (4, 192, 16, 16), (49152, 256, 16, 1))
        buf58 = empty_strided_cuda((768,), (1,), torch.float32)
        buf57 = buf56
        del buf56
        buf59 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf63 = buf45
        del buf45
        buf62 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_add_convolution_repeat_12[
            grid(768)](buf57, buf63, primals_28, primals_27, primals_29,
            buf58, buf59, buf62, 768, 256, num_warps=2, num_stages=1)
        del primals_27
        del primals_28
        del primals_29
        buf64 = empty_strided_cuda((4, 192, 18, 18), (62208, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_8[grid(248832)](buf63, buf64, 
            248832, XBLOCK=1024, num_warps=4, num_stages=1)
        buf65 = extern_kernels.convolution(buf64, primals_30, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf65, (4, 192, 16, 16), (49152, 256, 16, 1))
        buf66 = buf65
        del buf65
        buf69 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 1, 1), torch.
            float32)
        buf70 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf72 = reinterpret_tensor(buf70, (1, 768, 1, 1), (768, 1, 1, 1), 0)
        del buf70
        triton_per_fused__native_batch_norm_legit_convolution_9[grid(768)](
            buf66, buf72, primals_31, buf69, 768, 256, num_warps=2,
            num_stages=1)
        del primals_31
        buf67 = empty_strided_cuda((768,), (1,), torch.float32)
        triton_poi_fused_repeat_10[grid(768)](primals_32, buf67, 768,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_32
        buf68 = empty_strided_cuda((768,), (1,), torch.float32)
        triton_poi_fused_repeat_10[grid(768)](primals_33, buf68, 768,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_33
        buf73 = empty_strided_cuda((4, 192, 18, 18), (62208, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_11[grid(248832)](buf66,
            buf69, buf72, buf67, buf68, buf73, 248832, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf74 = extern_kernels.convolution(buf73, primals_34, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf74, (4, 192, 16, 16), (49152, 256, 16, 1))
        buf76 = empty_strided_cuda((768,), (1,), torch.float32)
        buf75 = buf74
        del buf74
        buf77 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf81 = buf63
        del buf63
        buf80 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_add_convolution_repeat_12[
            grid(768)](buf75, buf81, primals_36, primals_35, primals_37,
            buf76, buf77, buf80, 768, 256, num_warps=2, num_stages=1)
        del primals_35
        del primals_36
        del primals_37
        buf82 = empty_strided_cuda((4, 192, 18, 18), (62208, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_8[grid(248832)](buf81, buf82, 
            248832, XBLOCK=1024, num_warps=4, num_stages=1)
        buf83 = extern_kernels.convolution(buf82, primals_38, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf83, (4, 192, 16, 16), (49152, 256, 16, 1))
        buf84 = buf83
        del buf83
        buf87 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 1, 1), torch.
            float32)
        buf88 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf90 = reinterpret_tensor(buf88, (1, 768, 1, 1), (768, 1, 1, 1), 0)
        del buf88
        triton_per_fused__native_batch_norm_legit_convolution_9[grid(768)](
            buf84, buf90, primals_39, buf87, 768, 256, num_warps=2,
            num_stages=1)
        del primals_39
        buf85 = empty_strided_cuda((768,), (1,), torch.float32)
        triton_poi_fused_repeat_10[grid(768)](primals_40, buf85, 768,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_40
        buf86 = empty_strided_cuda((768,), (1,), torch.float32)
        triton_poi_fused_repeat_10[grid(768)](primals_41, buf86, 768,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_41
        buf91 = empty_strided_cuda((4, 192, 18, 18), (62208, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_11[grid(248832)](buf84,
            buf87, buf90, buf85, buf86, buf91, 248832, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf92 = extern_kernels.convolution(buf91, primals_42, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf92, (4, 192, 16, 16), (49152, 256, 16, 1))
        buf93 = buf92
        del buf92
        buf95 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf96 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        buf98 = empty_strided_cuda((1, 768, 1, 1), (768, 1, 768, 768),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_13[grid(768)](
            buf93, primals_43, buf95, buf96, buf98, 768, 256, num_warps=2,
            num_stages=1)
        del primals_43
        buf94 = empty_strided_cuda((768,), (1,), torch.float32)
        triton_poi_fused_repeat_10[grid(768)](primals_44, buf94, 768,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_44
        buf99 = empty_strided_cuda((32,), (1,), torch.int64)
        triton_poi_fused__to_copy_add_arange_mul_14[grid(32)](buf99, 32,
            XBLOCK=32, num_warps=1, num_stages=1)
        buf100 = empty_strided_cuda((4, 192, 34, 34), (221952, 1156, 34, 1),
            torch.float32)
        triton_poi_fused__unsafe_index_add_reflection_pad2d_15[grid(887808)](
            buf99, buf93, buf95, buf96, buf94, primals_45, buf81, buf100, 
            887808, XBLOCK=512, num_warps=8, num_stages=1)
        del buf81
        del buf96
        del primals_45
        buf101 = extern_kernels.convolution(buf100, primals_46, stride=(1, 
            1), padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf101, (4, 96, 32, 32), (98304, 1024, 32, 1))
        buf102 = buf101
        del buf101
        buf105 = empty_strided_cuda((1, 384, 1, 1), (384, 1, 1, 1), torch.
            float32)
        buf106 = empty_strided_cuda((1, 384, 1, 1), (384, 1, 384, 384),
            torch.float32)
        buf108 = reinterpret_tensor(buf106, (1, 384, 1, 1), (384, 1, 1, 1), 0)
        del buf106
        triton_per_fused__native_batch_norm_legit_convolution_4[grid(384)](
            buf102, buf108, primals_47, buf105, 384, 1024, num_warps=8,
            num_stages=1)
        del primals_47
        buf103 = empty_strided_cuda((384,), (1,), torch.float32)
        triton_poi_fused_repeat_5[grid(384)](primals_48, buf103, 384,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_48
        buf104 = empty_strided_cuda((384,), (1,), torch.float32)
        triton_poi_fused_repeat_5[grid(384)](primals_49, buf104, 384,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_49
        buf109 = empty_strided_cuda((64,), (1,), torch.int64)
        triton_poi_fused__to_copy_add_arange_mul_16[grid(64)](buf109, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        buf110 = empty_strided_cuda((4, 96, 66, 66), (418176, 4356, 66, 1),
            torch.float32)
        triton_poi_fused__unsafe_index_reflection_pad2d_relu_17[grid(1672704)](
            buf109, buf102, buf105, buf108, buf103, buf104, buf110, 1672704,
            XBLOCK=1024, num_warps=4, num_stages=1)
        buf111 = extern_kernels.convolution(buf110, primals_50, stride=(1, 
            1), padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf111, (4, 48, 64, 64), (196608, 4096, 64, 1))
        buf112 = buf111
        del buf111
        buf115 = empty_strided_cuda((1, 192, 1, 1), (192, 1, 1, 1), torch.
            float32)
        buf116 = empty_strided_cuda((1, 192, 1, 1), (192, 1, 192, 192),
            torch.float32)
        buf118 = reinterpret_tensor(buf116, (1, 192, 1, 1), (192, 1, 1, 1), 0)
        del buf116
        triton_red_fused__native_batch_norm_legit_convolution_1[grid(192)](
            buf112, buf118, primals_51, buf115, 192, 4096, XBLOCK=1, RBLOCK
            =2048, num_warps=16, num_stages=1)
        del primals_51
        buf113 = empty_strided_cuda((192,), (1,), torch.float32)
        triton_poi_fused_repeat_2[grid(192)](primals_52, buf113, 192,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_52
        buf114 = empty_strided_cuda((192,), (1,), torch.float32)
        triton_poi_fused_repeat_2[grid(192)](primals_53, buf114, 192,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_53
        buf119 = empty_strided_cuda((4, 48, 72, 72), (248832, 5184, 72, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_18[grid(995328)](buf112,
            buf115, buf118, buf113, buf114, buf119, 995328, XBLOCK=1024,
            num_warps=4, num_stages=1)
        buf120 = extern_kernels.convolution(buf119, primals_54, stride=(1, 
            1), padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf120, (4, 3, 64, 64), (12288, 4096, 64, 1))
        buf121 = buf120
        del buf120
        buf122 = empty_strided_cuda((4, 3, 64, 64), (12288, 4096, 64, 1),
            torch.float32)
        triton_poi_fused_add_convolution_div_mul_tanh_19[grid(49152)](buf121,
            primals_55, buf122, 49152, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_55
    return (buf122, primals_2, primals_6, primals_10, primals_14,
        primals_18, primals_22, primals_26, primals_30, primals_34,
        primals_38, primals_42, primals_46, primals_50, primals_54, buf0,
        buf2, buf3, buf4, buf5, buf8, buf9, buf11, buf12, buf13, buf14,
        buf17, buf18, buf20, buf21, buf22, buf23, buf26, buf28, buf30,
        buf31, buf32, buf33, buf36, buf37, buf39, buf40, reinterpret_tensor
        (buf44, (768,), (1,), 0), buf46, buf48, buf49, buf50, buf51, buf54,
        buf55, buf57, buf58, reinterpret_tensor(buf62, (768,), (1,), 0),
        buf64, buf66, buf67, buf68, buf69, buf72, buf73, buf75, buf76,
        reinterpret_tensor(buf80, (768,), (1,), 0), buf82, buf84, buf85,
        buf86, buf87, buf90, buf91, buf93, buf94, reinterpret_tensor(buf98,
        (768,), (1,), 0), buf99, buf100, buf102, buf103, buf104, buf105,
        buf108, buf109, buf110, buf112, buf113, buf114, buf115, buf118,
        buf119, buf121, reinterpret_tensor(buf95, (1, 768, 1, 1), (768, 1, 
        1, 1), 0), reinterpret_tensor(buf77, (1, 768, 1, 1), (768, 1, 1, 1),
        0), reinterpret_tensor(buf59, (1, 768, 1, 1), (768, 1, 1, 1), 0),
        reinterpret_tensor(buf41, (1, 768, 1, 1), (768, 1, 1, 1), 0))


class SelectiveLoadModule(torch.nn.Module):
    """Only load layers in trained models with the same name."""

    def __init__(self):
        super(SelectiveLoadModule, self).__init__()

    def forward(self, x):
        return x

    def load_state_dict(self, state_dict):
        """Override the function to ignore redundant weights."""
        own_state = self.state_dict()
        for name, param in state_dict.items():
            if name in own_state:
                own_state[name].copy_(param)


class ConvLayer(torch.nn.Module):
    """Reflection padded convolution layer."""

    def __init__(self, in_channels, out_channels, kernel_size, stride, bias
        =True):
        super(ConvLayer, self).__init__()
        reflection_padding = int(np.floor(kernel_size / 2))
        self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding)
        self.conv2d = torch.nn.Conv2d(in_channels, out_channels,
            kernel_size, stride=stride, bias=bias)

    def forward(self, x):
        out = self.reflection_pad(x)
        out = self.conv2d(out)
        return out


class ConvTanh(ConvLayer):

    def __init__(self, in_channels, out_channels, kernel_size, stride):
        super(ConvTanh, self).__init__(in_channels, out_channels,
            kernel_size, stride)
        self.tanh = torch.nn.Tanh()

    def forward(self, x):
        out = super(ConvTanh, self).forward(x)
        return self.tanh(out / 255) * 150 + 255 / 2


class ConvInstRelu(ConvLayer):

    def __init__(self, in_channels, out_channels, kernel_size, stride):
        super(ConvInstRelu, self).__init__(in_channels, out_channels,
            kernel_size, stride)
        self.instance = torch.nn.InstanceNorm2d(out_channels, affine=True)
        self.relu = torch.nn.ReLU()

    def forward(self, x):
        out = super(ConvInstRelu, self).forward(x)
        out = self.instance(out)
        out = self.relu(out)
        return out


class UpsampleConvLayer(torch.nn.Module):
    """Upsamples the input and then does a convolution.
    This method gives better results compared to ConvTranspose2d.
    ref: http://distill.pub/2016/deconv-checkerboard/
    """

    def __init__(self, in_channels, out_channels, kernel_size, stride,
        upsample=None):
        super(UpsampleConvLayer, self).__init__()
        self.upsample = upsample
        if upsample:
            self.upsample_layer = torch.nn.Upsample(scale_factor=upsample)
        reflection_padding = int(np.floor(kernel_size / 2))
        self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding)
        self.conv2d = torch.nn.Conv2d(in_channels, out_channels,
            kernel_size, stride)

    def forward(self, x):
        x_in = x
        if self.upsample:
            x_in = self.upsample_layer(x_in)
        out = self.reflection_pad(x_in)
        out = self.conv2d(out)
        return out


class UpsampleConvInstRelu(UpsampleConvLayer):

    def __init__(self, in_channels, out_channels, kernel_size, stride,
        upsample=None):
        super(UpsampleConvInstRelu, self).__init__(in_channels,
            out_channels, kernel_size, stride, upsample)
        self.instance = torch.nn.InstanceNorm2d(out_channels, affine=True)
        self.relu = torch.nn.ReLU()

    def forward(self, x):
        out = super(UpsampleConvInstRelu, self).forward(x)
        out = self.instance(out)
        out = self.relu(out)
        return out


class ResidualBlock(torch.nn.Module):

    def __init__(self, in_channels, out_channels, kernel_size=3, stride=1):
        super(ResidualBlock, self).__init__()
        self.conv1 = ConvLayer(in_channels, out_channels, kernel_size, stride)
        self.in1 = torch.nn.InstanceNorm2d(out_channels, affine=True)
        self.conv2 = ConvLayer(out_channels, out_channels, kernel_size, stride)
        self.in2 = torch.nn.InstanceNorm2d(out_channels, affine=True)
        self.relu = torch.nn.ReLU()

    def forward(self, x):
        residual = x
        out = self.relu(self.in1(self.conv1(x)))
        out = self.in2(self.conv2(out))
        out = out + residual
        return out


class ReCoNet2New(SelectiveLoadModule):

    def __init__(self):
        super(ReCoNet2New, self).__init__()
        self.style_conv1 = ConvInstRelu(3, 48, kernel_size=9, stride=1)
        self.style_conv2 = ConvInstRelu(48, 96, kernel_size=3, stride=2)
        self.style_conv3 = ConvInstRelu(96, 192, kernel_size=3, stride=2)
        self.style_res1 = ResidualBlock(192, 192)
        self.style_res2 = ResidualBlock(192, 192)
        self.style_res3 = ResidualBlock(192, 192)
        self.style_res4 = ResidualBlock(192, 192)
        self.style_deconv1 = UpsampleConvInstRelu(192, 96, kernel_size=3,
            stride=1, upsample=2)
        self.style_deconv2 = UpsampleConvInstRelu(96, 48, kernel_size=3,
            stride=1, upsample=2)
        self.style_deconv3 = ConvTanh(48, 3, kernel_size=9, stride=1)

    def forward(self, input_0):
        primals_2 = self.style_conv1.conv2d.weight
        primals_3 = self.style_conv1.conv2d.bias
        primals_4 = self.style_conv1.instance.weight
        primals_5 = self.style_conv1.instance.bias
        primals_6 = self.style_conv2.conv2d.weight
        primals_7 = self.style_conv2.conv2d.bias
        primals_8 = self.style_conv2.instance.weight
        primals_9 = self.style_conv2.instance.bias
        primals_10 = self.style_conv3.conv2d.weight
        primals_11 = self.style_conv3.conv2d.bias
        primals_12 = self.style_conv3.instance.weight
        primals_13 = self.style_conv3.instance.bias
        primals_14 = self.style_res1.conv1.conv2d.weight
        primals_15 = self.style_res1.conv1.conv2d.bias
        primals_16 = self.style_res1.in1.weight
        primals_17 = self.style_res1.in1.bias
        primals_18 = self.style_res1.conv2.conv2d.weight
        primals_19 = self.style_res1.conv2.conv2d.bias
        primals_20 = self.style_res1.in2.weight
        primals_21 = self.style_res1.in2.bias
        primals_22 = self.style_res2.conv1.conv2d.weight
        primals_23 = self.style_res2.conv1.conv2d.bias
        primals_24 = self.style_res2.in1.weight
        primals_25 = self.style_res2.in1.bias
        primals_26 = self.style_res2.conv2.conv2d.weight
        primals_27 = self.style_res2.conv2.conv2d.bias
        primals_28 = self.style_res2.in2.weight
        primals_29 = self.style_res2.in2.bias
        primals_30 = self.style_res3.conv1.conv2d.weight
        primals_31 = self.style_res3.conv1.conv2d.bias
        primals_32 = self.style_res3.in1.weight
        primals_33 = self.style_res3.in1.bias
        primals_34 = self.style_res3.conv2.conv2d.weight
        primals_35 = self.style_res3.conv2.conv2d.bias
        primals_36 = self.style_res3.in2.weight
        primals_37 = self.style_res3.in2.bias
        primals_38 = self.style_res4.conv1.conv2d.weight
        primals_39 = self.style_res4.conv1.conv2d.bias
        primals_40 = self.style_res4.in1.weight
        primals_41 = self.style_res4.in1.bias
        primals_42 = self.style_res4.conv2.conv2d.weight
        primals_43 = self.style_res4.conv2.conv2d.bias
        primals_44 = self.style_res4.in2.weight
        primals_45 = self.style_res4.in2.bias
        primals_46 = self.style_deconv1.conv2d.weight
        primals_47 = self.style_deconv1.conv2d.bias
        primals_48 = self.style_deconv1.instance.weight
        primals_49 = self.style_deconv1.instance.bias
        primals_50 = self.style_deconv2.conv2d.weight
        primals_51 = self.style_deconv2.conv2d.bias
        primals_52 = self.style_deconv2.instance.weight
        primals_53 = self.style_deconv2.instance.bias
        primals_54 = self.style_deconv3.conv2d.weight
        primals_55 = self.style_deconv3.conv2d.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, primals_28, primals_29,
            primals_30, primals_31, primals_32, primals_33, primals_34,
            primals_35, primals_36, primals_37, primals_38, primals_39,
            primals_40, primals_41, primals_42, primals_43, primals_44,
            primals_45, primals_46, primals_47, primals_48, primals_49,
            primals_50, primals_51, primals_52, primals_53, primals_54,
            primals_55])
        return output[0]


Measured latency_ms: 1.116372