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
from torch import nn
from torch.nn import 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_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 = 128
    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 % 32
    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_reflection_pad2d_relu_2(in_ptr0, in_ptr1, in_ptr2,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 540800
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 65
    x1 = xindex // 65 % 65
    x2 = xindex // 4225
    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')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tl.store(out_ptr0 + x3, tmp6, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_3(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 % 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 = 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_reflection_pad2d_relu_4(in_ptr0, in_ptr1, in_ptr2,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 278784
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 33
    x1 = xindex // 33 % 33
    x2 = xindex // 1089
    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')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tl.store(out_ptr0 + x3, tmp6, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_5(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 % 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 = 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_reflection_pad2d_relu_6(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')
    tmp1 = tl.load(in_ptr1 + x2, None, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x2, None, eviction_policy='evict_last')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tl.store(out_ptr0 + x3, tmp6, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_add_convolution_relu_7(
    in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0, 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)
    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')
    tmp23 = tl.load(in_ptr1 + (r2 + 256 * x3), None)
    tmp24 = tl.load(in_ptr2 + x3, None, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr3 + x3, 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 = tmp2 - tmp10
    tmp17 = 256.0
    tmp18 = tmp15 / tmp17
    tmp19 = 1e-05
    tmp20 = tmp18 + tmp19
    tmp21 = libdevice.rsqrt(tmp20)
    tmp22 = tmp16 * tmp21
    tmp25 = tmp23 - tmp24
    tmp27 = tmp25 * tmp26
    tmp28 = tl.full([1], 0, tl.int32)
    tmp29 = triton_helpers.maximum(tmp28, tmp27)
    tmp30 = tmp22 + tmp29
    tl.store(in_out_ptr0 + (r2 + 256 * x3), tmp2, None)
    tl.store(out_ptr2 + (r2 + 256 * x3), tmp30, None)
    tl.store(out_ptr3 + x3, tmp21, None)
    tl.store(out_ptr0 + x3, tmp10, 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 = 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_add_reflection_pad2d_10(in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, 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')
    tmp1 = tl.load(in_ptr1 + x2, None, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x2, None, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr3 + (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')
    tmp2 = tmp0 - tmp1
    tmp4 = 256.0
    tmp5 = tmp3 / tmp4
    tmp6 = 1e-05
    tmp7 = tmp5 + tmp6
    tmp8 = libdevice.rsqrt(tmp7)
    tmp9 = tmp2 * tmp8
    tmp11 = tmp9 + tmp10
    tl.store(out_ptr0 + x3, tmp11, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_add_convolution_11(in_out_ptr0,
    in_out_ptr1, in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0, 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')
    tmp23 = tl.load(in_ptr1 + (r2 + 256 * x3), None)
    tmp24 = tl.load(in_ptr2 + x3, None, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr3 + x3, None, eviction_policy='evict_last')
    tmp31 = tl.load(in_out_ptr1 + (r2 + 256 * x3), None)
    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 = tmp2 - tmp10
    tmp17 = 256.0
    tmp18 = tmp15 / tmp17
    tmp19 = 1e-05
    tmp20 = tmp18 + tmp19
    tmp21 = libdevice.rsqrt(tmp20)
    tmp22 = tmp16 * tmp21
    tmp25 = tmp23 - tmp24
    tmp27 = tmp26 / tmp17
    tmp28 = tmp27 + tmp19
    tmp29 = libdevice.rsqrt(tmp28)
    tmp30 = tmp25 * tmp29
    tmp32 = tmp30 + tmp31
    tmp33 = tmp22 + tmp32
    tl.store(in_out_ptr0 + (r2 + 256 * x3), tmp2, None)
    tl.store(in_out_ptr1 + (r2 + 256 * x3), tmp33, None)
    tl.store(out_ptr2 + x3, tmp21, None)
    tl.store(out_ptr0 + x3, tmp10, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_relu_12(in_out_ptr0,
    in_ptr0, out_ptr0, out_ptr2, out_ptr3, 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 = 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 = tmp2 - tmp10
    tmp17 = 1024.0
    tmp18 = tmp15 / tmp17
    tmp19 = 1e-05
    tmp20 = tmp18 + tmp19
    tmp21 = libdevice.rsqrt(tmp20)
    tmp22 = tmp16 * tmp21
    tmp23 = tl.full([1], 0, tl.int32)
    tmp24 = triton_helpers.maximum(tmp23, tmp22)
    tl.store(in_out_ptr0 + (r2 + 1024 * x3), tmp2, None)
    tl.store(out_ptr2 + (r2 + 1024 * x3), tmp24, None)
    tl.store(out_ptr3 + x3, tmp21, None)
    tl.store(out_ptr0 + x3, tmp10, None)


@triton.jit
def triton_poi_fused_reflection_pad2d_relu_13(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 % 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')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tl.store(out_ptr0 + x3, tmp6, None)


@triton.jit
def triton_red_fused__native_batch_norm_legit_add_convolution_mul_tanh_14(
    in_out_ptr0, in_out_ptr1, in_ptr0, out_ptr0, out_ptr1, xnumel, rnumel,
    XBLOCK: tl.constexpr, RBLOCK: tl.constexpr):
    xnumel = 12
    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 % 3
    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)
    for roffset in range(0, rnumel, RBLOCK):
        rindex = roffset + rbase
        rmask = rindex < rnumel
        r2 = rindex
        tmp12 = tl.load(in_out_ptr0 + (r2 + 4096 * x3), rmask & xmask,
            eviction_policy='evict_first', other=0.0)
        tmp13 = tmp12 - tmp4
        tmp14 = tmp13 * tmp11
        tmp15 = libdevice.tanh(tmp14)
        tmp16 = 0.5
        tmp17 = tmp15 * tmp16
        tmp18 = tmp17 + tmp16
        tl.store(out_ptr1 + (r2 + 4096 * x3), tmp18, rmask & xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10, primals_11, primals_12,
        primals_13, primals_14, primals_15, primals_16, primals_17,
        primals_18, primals_19, primals_20, primals_21, primals_22,
        primals_23, primals_24, primals_25, primals_26, primals_27,
        primals_28, primals_29, primals_30, primals_31, primals_32, primals_33
        ) = args
    args.clear()
    assert_size_stride(primals_1, (4, 3, 64, 64), (12288, 4096, 64, 1))
    assert_size_stride(primals_2, (32, 3, 9, 9), (243, 81, 9, 1))
    assert_size_stride(primals_3, (32,), (1,))
    assert_size_stride(primals_4, (64, 32, 3, 3), (288, 9, 3, 1))
    assert_size_stride(primals_5, (64,), (1,))
    assert_size_stride(primals_6, (128, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_7, (128,), (1,))
    assert_size_stride(primals_8, (128, 128, 3, 3), (1152, 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, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_13, (128,), (1,))
    assert_size_stride(primals_14, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_15, (128,), (1,))
    assert_size_stride(primals_16, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_17, (128,), (1,))
    assert_size_stride(primals_18, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_19, (128,), (1,))
    assert_size_stride(primals_20, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_21, (128,), (1,))
    assert_size_stride(primals_22, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_23, (128,), (1,))
    assert_size_stride(primals_24, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_25, (128,), (1,))
    assert_size_stride(primals_26, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_27, (128,), (1,))
    assert_size_stride(primals_28, (128, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_29, (64,), (1,))
    assert_size_stride(primals_30, (64, 32, 3, 3), (288, 9, 3, 1))
    assert_size_stride(primals_31, (32,), (1,))
    assert_size_stride(primals_32, (3, 32, 9, 9), (2592, 81, 9, 1))
    assert_size_stride(primals_33, (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, 32, 64, 64), (131072, 4096, 64, 1))
        buf2 = buf1
        del buf1
        buf3 = empty_strided_cuda((1, 128, 1, 1), (128, 1, 1, 1), torch.float32
            )
        buf4 = empty_strided_cuda((1, 128, 1, 1), (128, 1, 128, 128), torch
            .float32)
        buf6 = reinterpret_tensor(buf4, (1, 128, 1, 1), (128, 1, 1, 1), 0)
        del buf4
        triton_red_fused__native_batch_norm_legit_convolution_1[grid(128)](buf2
            , buf6, primals_3, buf3, 128, 4096, XBLOCK=1, RBLOCK=2048,
            num_warps=16, num_stages=1)
        del primals_3
        buf7 = empty_strided_cuda((4, 32, 65, 65), (135200, 4225, 65, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_2[grid(540800)](buf2, buf3,
            buf6, buf7, 540800, XBLOCK=1024, num_warps=4, num_stages=1)
        buf8 = extern_kernels.convolution(buf7, primals_4, stride=(2, 2),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf8, (4, 64, 32, 32), (65536, 1024, 32, 1))
        buf9 = buf8
        del buf8
        buf10 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 1, 1), torch.
            float32)
        buf11 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf13 = reinterpret_tensor(buf11, (1, 256, 1, 1), (256, 1, 1, 1), 0)
        del buf11
        triton_per_fused__native_batch_norm_legit_convolution_3[grid(256)](buf9
            , buf13, primals_5, buf10, 256, 1024, num_warps=8, num_stages=1)
        del primals_5
        buf14 = empty_strided_cuda((4, 64, 33, 33), (69696, 1089, 33, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_4[grid(278784)](buf9, buf10,
            buf13, buf14, 278784, XBLOCK=512, num_warps=8, num_stages=1)
        buf15 = extern_kernels.convolution(buf14, primals_6, stride=(2, 2),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf15, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf16 = buf15
        del buf15
        buf17 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 1, 1), torch.
            float32)
        buf18 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf20 = reinterpret_tensor(buf18, (1, 512, 1, 1), (512, 1, 1, 1), 0)
        del buf18
        triton_per_fused__native_batch_norm_legit_convolution_5[grid(512)](
            buf16, buf20, primals_7, buf17, 512, 256, num_warps=2, num_stages=1
            )
        del primals_7
        buf21 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_6[grid(165888)](buf16, buf17,
            buf20, buf21, 165888, XBLOCK=1024, num_warps=4, num_stages=1)
        buf22 = extern_kernels.convolution(buf21, primals_8, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf22, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf23 = buf22
        del buf22
        buf24 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 1, 1), torch.
            float32)
        buf25 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf27 = reinterpret_tensor(buf25, (1, 512, 1, 1), (512, 1, 1, 1), 0)
        del buf25
        triton_per_fused__native_batch_norm_legit_convolution_5[grid(512)](
            buf23, buf27, primals_9, buf24, 512, 256, num_warps=2, num_stages=1
            )
        del primals_9
        buf28 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_6[grid(165888)](buf23, buf24,
            buf27, buf28, 165888, XBLOCK=1024, num_warps=4, num_stages=1)
        buf29 = extern_kernels.convolution(buf28, primals_10, 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 = buf29
        del buf29
        buf31 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf35 = empty_strided_cuda((4, 128, 16, 16), (32768, 256, 16, 1),
            torch.float32)
        buf34 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_add_convolution_relu_7[grid
            (512)](buf30, primals_11, buf16, buf17, buf20, buf31, buf35,
            buf34, 512, 256, num_warps=2, num_stages=1)
        del primals_11
        buf36 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_8[grid(165888)](buf35, buf36, 
            165888, XBLOCK=512, num_warps=8, num_stages=1)
        buf37 = extern_kernels.convolution(buf36, primals_12, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf37, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf38 = buf37
        del buf37
        buf39 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 1, 1), torch.
            float32)
        buf40 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf42 = reinterpret_tensor(buf40, (1, 512, 1, 1), (512, 1, 1, 1), 0)
        del buf40
        triton_per_fused__native_batch_norm_legit_convolution_5[grid(512)](
            buf38, buf42, primals_13, buf39, 512, 256, num_warps=2,
            num_stages=1)
        del primals_13
        buf43 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_6[grid(165888)](buf38, buf39,
            buf42, buf43, 165888, XBLOCK=1024, num_warps=4, num_stages=1)
        buf44 = extern_kernels.convolution(buf43, primals_14, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf44, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf45 = buf44
        del buf44
        buf46 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf47 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf49 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_9[grid(512)](
            buf45, primals_15, buf46, buf47, buf49, 512, 256, num_warps=2,
            num_stages=1)
        del primals_15
        buf50 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_add_reflection_pad2d_10[grid(165888)](buf45, buf46,
            buf47, buf35, buf50, 165888, XBLOCK=1024, num_warps=4, num_stages=1
            )
        buf51 = extern_kernels.convolution(buf50, primals_16, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf51, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf52 = buf51
        del buf51
        buf53 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 1, 1), torch.
            float32)
        buf54 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf56 = reinterpret_tensor(buf54, (1, 512, 1, 1), (512, 1, 1, 1), 0)
        del buf54
        triton_per_fused__native_batch_norm_legit_convolution_5[grid(512)](
            buf52, buf56, primals_17, buf53, 512, 256, num_warps=2,
            num_stages=1)
        del primals_17
        buf57 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_6[grid(165888)](buf52, buf53,
            buf56, buf57, 165888, XBLOCK=1024, num_warps=4, num_stages=1)
        buf58 = extern_kernels.convolution(buf57, primals_18, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf58, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf59 = buf58
        del buf58
        buf60 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf64 = buf35
        del buf35
        buf63 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_add_convolution_11[grid(512)
            ](buf59, buf64, primals_19, buf45, buf46, buf47, buf60, buf63, 
            512, 256, num_warps=2, num_stages=1)
        del primals_19
        buf65 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_8[grid(165888)](buf64, buf65, 
            165888, XBLOCK=512, num_warps=8, num_stages=1)
        buf66 = extern_kernels.convolution(buf65, primals_20, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf66, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf67 = buf66
        del buf66
        buf68 = reinterpret_tensor(buf47, (1, 512, 1, 1), (512, 1, 1, 1), 0)
        del buf47
        buf69 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf71 = reinterpret_tensor(buf69, (1, 512, 1, 1), (512, 1, 1, 1), 0)
        del buf69
        triton_per_fused__native_batch_norm_legit_convolution_5[grid(512)](
            buf67, buf71, primals_21, buf68, 512, 256, num_warps=2,
            num_stages=1)
        del primals_21
        buf72 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_6[grid(165888)](buf67, buf68,
            buf71, buf72, 165888, XBLOCK=1024, num_warps=4, num_stages=1)
        buf73 = extern_kernels.convolution(buf72, primals_22, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf73, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf74 = buf73
        del buf73
        buf75 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf76 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf78 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_9[grid(512)](
            buf74, primals_23, buf75, buf76, buf78, 512, 256, num_warps=2,
            num_stages=1)
        del primals_23
        buf79 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_add_reflection_pad2d_10[grid(165888)](buf74, buf75,
            buf76, buf64, buf79, 165888, XBLOCK=1024, num_warps=4, num_stages=1
            )
        buf80 = extern_kernels.convolution(buf79, primals_24, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf80, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf81 = buf80
        del buf80
        buf82 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 1, 1), torch.
            float32)
        buf83 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf85 = reinterpret_tensor(buf83, (1, 512, 1, 1), (512, 1, 1, 1), 0)
        del buf83
        triton_per_fused__native_batch_norm_legit_convolution_5[grid(512)](
            buf81, buf85, primals_25, buf82, 512, 256, num_warps=2,
            num_stages=1)
        del primals_25
        buf86 = empty_strided_cuda((4, 128, 18, 18), (41472, 324, 18, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_6[grid(165888)](buf81, buf82,
            buf85, buf86, 165888, XBLOCK=1024, num_warps=4, num_stages=1)
        buf87 = extern_kernels.convolution(buf86, primals_26, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf87, (4, 128, 16, 16), (32768, 256, 16, 1))
        buf88 = buf87
        del buf87
        buf89 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        buf93 = buf64
        del buf64
        buf92 = empty_strided_cuda((1, 512, 1, 1), (512, 1, 512, 512),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_add_convolution_11[grid(512)
            ](buf88, buf93, primals_27, buf74, buf75, buf76, buf89, buf92, 
            512, 256, num_warps=2, num_stages=1)
        del buf76
        del primals_27
        buf94 = extern_kernels.convolution(buf93, primals_28, stride=(2, 2),
            padding=(1, 1), dilation=(1, 1), transposed=True,
            output_padding=(1, 1), groups=1, bias=None)
        assert_size_stride(buf94, (4, 64, 32, 32), (65536, 1024, 32, 1))
        buf95 = buf94
        del buf94
        buf96 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf100 = empty_strided_cuda((4, 64, 32, 32), (65536, 1024, 32, 1),
            torch.float32)
        buf99 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        triton_per_fused__native_batch_norm_legit_convolution_relu_12[grid(256)
            ](buf95, primals_29, buf96, buf100, buf99, 256, 1024, num_warps
            =8, num_stages=1)
        del primals_29
        buf101 = extern_kernels.convolution(buf100, primals_30, stride=(2, 
            2), padding=(1, 1), dilation=(1, 1), transposed=True,
            output_padding=(1, 1), groups=1, bias=None)
        assert_size_stride(buf101, (4, 32, 64, 64), (131072, 4096, 64, 1))
        buf102 = buf101
        del buf101
        buf103 = empty_strided_cuda((1, 128, 1, 1), (128, 1, 1, 1), torch.
            float32)
        buf104 = empty_strided_cuda((1, 128, 1, 1), (128, 1, 128, 128),
            torch.float32)
        buf106 = reinterpret_tensor(buf104, (1, 128, 1, 1), (128, 1, 1, 1), 0)
        del buf104
        triton_red_fused__native_batch_norm_legit_convolution_1[grid(128)](
            buf102, buf106, primals_31, buf103, 128, 4096, XBLOCK=1, RBLOCK
            =2048, num_warps=16, num_stages=1)
        del primals_31
        buf107 = empty_strided_cuda((4, 32, 72, 72), (165888, 5184, 72, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_relu_13[grid(663552)](buf102,
            buf103, buf106, buf107, 663552, XBLOCK=1024, num_warps=4,
            num_stages=1)
        buf108 = extern_kernels.convolution(buf107, primals_32, stride=(1, 
            1), padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf108, (4, 3, 64, 64), (12288, 4096, 64, 1))
        buf109 = buf108
        del buf108
        buf110 = empty_strided_cuda((1, 12, 1, 1), (12, 1, 1, 1), torch.float32
            )
        buf111 = empty_strided_cuda((1, 12, 1, 1), (12, 1, 12, 12), torch.
            float32)
        buf113 = reinterpret_tensor(buf111, (1, 12, 1, 1), (12, 1, 1, 1), 0)
        del buf111
        buf114 = empty_strided_cuda((4, 3, 64, 64), (12288, 4096, 64, 1),
            torch.float32)
        triton_red_fused__native_batch_norm_legit_add_convolution_mul_tanh_14[
            grid(12)](buf109, buf113, primals_33, buf110, buf114, 12, 4096,
            XBLOCK=1, RBLOCK=2048, num_warps=16, num_stages=1)
        del primals_33
    return (buf114, primals_2, primals_4, primals_6, primals_8, primals_10,
        primals_12, primals_14, primals_16, primals_18, primals_20,
        primals_22, primals_24, primals_26, primals_28, primals_30,
        primals_32, buf0, buf2, buf3, buf6, buf7, buf9, buf10, buf13, buf14,
        buf16, buf17, buf20, buf21, buf23, buf24, buf27, buf28, buf30,
        reinterpret_tensor(buf34, (512,), (1,), 0), buf36, buf38, buf39,
        buf42, buf43, buf45, reinterpret_tensor(buf49, (512,), (1,), 0),
        buf50, buf52, buf53, buf56, buf57, buf59, reinterpret_tensor(buf63,
        (512,), (1,), 0), buf65, buf67, buf68, buf71, buf72, buf74,
        reinterpret_tensor(buf78, (512,), (1,), 0), buf79, buf81, buf82,
        buf85, buf86, buf88, reinterpret_tensor(buf92, (512,), (1,), 0),
        buf93, buf95, reinterpret_tensor(buf99, (256,), (1,), 0), buf100,
        buf102, buf103, buf106, buf107, buf109, buf110, buf113,
        reinterpret_tensor(buf96, (1, 256, 1, 1), (256, 1, 1, 1), 0),
        reinterpret_tensor(buf89, (1, 512, 1, 1), (512, 1, 1, 1), 0),
        reinterpret_tensor(buf75, (1, 512, 1, 1), (512, 1, 1, 1), 0),
        reinterpret_tensor(buf60, (1, 512, 1, 1), (512, 1, 1, 1), 0),
        reinterpret_tensor(buf46, (1, 512, 1, 1), (512, 1, 1, 1), 0),
        reinterpret_tensor(buf31, (1, 512, 1, 1), (512, 1, 1, 1), 0))


def reflect_padding(x, f, s, half=False):
    if half:
        denom = 2
    else:
        denom = 1
    _, _, h, w = x.shape
    pad_w = w * (s / denom - 1) + f - s
    pad_h = h * (s / denom - 1) + f - s
    if pad_w % 2 == 1:
        pad_l = int(pad_w // 2) + 1
        pad_r = int(pad_w // 2)
    else:
        pad_l = pad_r = int(pad_w / 2)
    if pad_h % 2 == 1:
        pad_t = int(pad_h // 2) + 1
        pad_b = int(pad_h // 2)
    else:
        pad_t = pad_b = int(pad_h / 2)
    return F.pad(x, [pad_l, pad_r, pad_t, pad_b], mode='reflect')


class Residual(nn.Module):
    """Unlinke other blocks, this module receives unpadded inputs."""

    def __init__(self, channels, kernel_size=3):
        super(Residual, self).__init__()
        padding = int((kernel_size - 1) / 2)
        self.pad = nn.ReflectionPad2d(padding)
        self.conv1 = nn.Conv2d(channels, channels, kernel_size)
        self.bn1 = nn.InstanceNorm2d(channels)
        self.conv2 = nn.Conv2d(channels, channels, kernel_size)
        self.bn2 = nn.InstanceNorm2d(channels)

    def forward(self, x):
        h = self.pad(x)
        h = self.conv1(h)
        h = self.bn1(h)
        h = F.relu(h)
        h = self.pad(h)
        h = self.conv2(h)
        h = self.bn2(h)
        h = h + x
        return h


class Conv(nn.Module):
    """Convolutional block. 2d-conv -> batch norm -> (optionally) relu"""

    def __init__(self, in_channels, out_channels, kernel, stride=1,
        use_relu=True):
        super(Conv, self).__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, kernel, stride)
        self.batch_norm = nn.InstanceNorm2d(out_channels)
        self.use_relu = use_relu

    def forward(self, x):
        h = self.conv(x)
        h = self.batch_norm(h)
        if self.use_relu:
            h = F.relu(h)
        return h


class ConvTran(nn.Module):

    def __init__(self, in_channels, out_channels):
        super(ConvTran, self).__init__()
        self.conv_t = nn.ConvTranspose2d(in_channels, out_channels, 3, 2, 1, 1)
        self.batch_norm = nn.InstanceNorm2d(out_channels)

    def forward(self, x):
        h = self.conv_t(x)
        h = self.batch_norm(h)
        return F.relu(h)


class FastStyleNew(nn.Module):

    def __init__(self):
        super(FastStyleNew, self).__init__()
        self.conv1 = Conv(3, 32, 9)
        self.conv2 = Conv(32, 64, 3, 2)
        self.conv3 = Conv(64, 128, 3, 2)
        self.res1 = Residual(128)
        self.res2 = Residual(128)
        self.res3 = Residual(128)
        self.res4 = Residual(128)
        self.res5 = Residual(128)
        self.convT1 = ConvTran(128, 64)
        self.convT2 = ConvTran(64, 32)
        self.conv_out = Conv(32, 3, 9, use_relu=False)
        self._init()

    def _init(self):

        def __init(m):
            if isinstance(m, nn.Conv2d):
                nn.init.xavier_uniform_(m.weight)
                nn.init.constant_(m.bias, 0)
            if isinstance(m, nn.ConvTranspose2d):
                nn.init.xavier_uniform_(m.weight)
                nn.init.constant_(m.bias, 0)
        self.apply(__init)

    def forward(self, input_0):
        primals_2 = self.conv1.conv.weight
        primals_3 = self.conv1.conv.bias
        primals_4 = self.conv2.conv.weight
        primals_5 = self.conv2.conv.bias
        primals_6 = self.conv3.conv.weight
        primals_7 = self.conv3.conv.bias
        primals_8 = self.res1.conv1.weight
        primals_9 = self.res1.conv1.bias
        primals_10 = self.res1.conv2.weight
        primals_11 = self.res1.conv2.bias
        primals_12 = self.res2.conv1.weight
        primals_13 = self.res2.conv1.bias
        primals_14 = self.res2.conv2.weight
        primals_15 = self.res2.conv2.bias
        primals_16 = self.res3.conv1.weight
        primals_17 = self.res3.conv1.bias
        primals_18 = self.res3.conv2.weight
        primals_19 = self.res3.conv2.bias
        primals_20 = self.res4.conv1.weight
        primals_21 = self.res4.conv1.bias
        primals_22 = self.res4.conv2.weight
        primals_23 = self.res4.conv2.bias
        primals_24 = self.res5.conv1.weight
        primals_25 = self.res5.conv1.bias
        primals_26 = self.res5.conv2.weight
        primals_27 = self.res5.conv2.bias
        primals_28 = self.convT1.conv_t.weight
        primals_29 = self.convT1.conv_t.bias
        primals_30 = self.convT2.conv_t.weight
        primals_31 = self.convT2.conv_t.bias
        primals_32 = self.conv_out.conv.weight
        primals_33 = self.conv_out.conv.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])
        return output[0]


Measured latency_ms: 0.031218