import torch
from torch import nn
import torch.nn.functional as F


class ConvBlock(nn.Module):

    def __init__(self, in_channels, out_channels, dropout=False, norm=None,
        residual=True, activation='leakyrelu', in_place_activation=True,
        transpose=False, reflectpad=True):
        super(ConvBlock, self).__init__()
        self.dropout = dropout
        self.residual = residual
        self.activation = activation
        self.transpose = transpose
        self.reflectpad = reflectpad
        if self.dropout:
            self.dropout1 = nn.Dropout2d(p=0.05)
            self.dropout2 = nn.Dropout2d(p=0.05)
        self.norm1 = None
        self.norm2 = None
        if norm is not None:
            if norm == 'batch':
                self.norm1 = nn.BatchNorm2d(out_channels)
                self.norm2 = nn.BatchNorm2d(out_channels)
            elif norm == 'instance':
                self.norm1 = nn.InstanceNorm2d(out_channels, affine=True)
                self.norm2 = nn.InstanceNorm2d(out_channels, affine=True)
        if self.transpose:
            self.conv1 = nn.ConvTranspose2d(in_channels, out_channels,
                kernel_size=3, padding=0 if self.reflectpad else 1)
            self.conv2 = nn.ConvTranspose2d(out_channels, out_channels,
                kernel_size=3, padding=0 if self.reflectpad else 1)
        else:
            self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3,
                padding=0 if self.reflectpad else 1)
            self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=
                3, padding=0 if self.reflectpad else 1)
        if self.activation == 'relu':
            self.actfun1 = nn.ReLU(inplace=in_place_activation)
            self.actfun2 = nn.ReLU(inplace=in_place_activation)
        elif self.activation == 'leakyrelu':
            self.actfun1 = nn.LeakyReLU(inplace=in_place_activation)
            self.actfun2 = nn.LeakyReLU(inplace=in_place_activation)
        elif self.activation == 'elu':
            self.actfun1 = nn.ELU(inplace=in_place_activation)
            self.actfun2 = nn.ELU(inplace=in_place_activation)
        elif self.activation == 'selu':
            self.actfun1 = nn.SELU(inplace=in_place_activation)
            self.actfun2 = nn.SELU(inplace=in_place_activation)
        if self.reflectpad:
            self.rpad1 = nn.ReflectionPad2d(1)
            self.rpad2 = nn.ReflectionPad2d(1)

    def forward(self, x):
        ox = x
        if self.reflectpad:
            x = self.rpad1(x)
        x = self.conv1(x)
        if self.dropout:
            x = self.dropout1(x)
        x = self.actfun1(x)
        if self.norm1:
            x = self.norm1(x)
        if self.reflectpad:
            x = self.rpad2(x)
        x = self.conv2(x)
        if self.dropout:
            x = self.dropout2(x)
        if self.residual:
            x[:, 0:min(ox.shape[1], x.shape[1]), :, :] += ox[:, 0:min(ox.
                shape[1], x.shape[1]), :, :]
        x = self.actfun2(x)
        if self.norm2:
            x = self.norm2(x)
        return x


class BabyUnet(nn.Module):

    def __init__(self, n_channel_in=1, n_channel_out=1):
        super(BabyUnet, self).__init__()
        self.pool1 = nn.AvgPool2d(kernel_size=2)
        self.pool2 = nn.AvgPool2d(kernel_size=2)
        self.up1 = lambda x: F.interpolate(x, mode='bilinear', scale_factor=2)
        self.up2 = lambda x: F.interpolate(x, mode='bilinear', scale_factor=2)
        self.conv1 = ConvBlock(n_channel_in, 16)
        self.conv2 = ConvBlock(16, 32)
        self.conv3 = ConvBlock(32, 32)
        self.conv4 = ConvBlock(64, 32)
        self.conv5 = ConvBlock(48, 16)
        self.conv6 = nn.Conv2d(16, n_channel_out, 1)

    def forward(self, x):
        c1 = self.conv1(x)
        x = self.pool1(c1)
        c2 = self.conv2(x)
        x = self.pool2(c2)
        self.conv3(x)
        x = self.up1(x)
        x = torch.cat([x, c2], 1)
        x = self.conv4(x)
        x = self.up2(x)
        x = torch.cat([x, c1], 1)
        x = self.conv5(x)
        x = self.conv6(x)
        return x


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


def get_init_inputs():
    return [[], {}]

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 math as tl_math
from torch import nn
import torch.nn.functional as F
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda


@triton.jit
def triton_poi_fused_reflection_pad2d_0(in_ptr0, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 17424
    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')
    tl.store(out_ptr0 + x3, tmp0, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_reflection_pad2d_1(in_ptr0,
    in_ptr1, 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 % 66
    x1 = xindex // 66 % 66
    x4 = xindex // 4356
    x2 = xindex // 4356 % 16
    x5 = 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 * x4),
        xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x5, tmp7, xmask)


@triton.jit
def triton_poi_fused_add_convolution_leaky_relu_2(in_out_ptr0, in_ptr0,
    in_ptr1, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x1 = xindex // 4096 % 16
    x3 = xindex
    x0 = xindex % 4096
    x2 = xindex // 65536
    tmp21 = tl.load(in_out_ptr0 + x3, None)
    tmp22 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp0 = x1
    tmp1 = tl.full([1], 1, tl.int64)
    tmp2 = tmp0 < tmp1
    tmp3 = tmp2 & tmp2
    tmp4 = tl.load(in_out_ptr0 + x3, tmp3, other=0.0)
    tmp5 = tl.load(in_ptr0 + x1, tmp3, eviction_policy='evict_last', other=0.0)
    tmp6 = tmp4 + tmp5
    tmp7 = tl.load(in_ptr1 + (x0 + 4096 * x2), tmp3, eviction_policy=
        'evict_last', other=0.0)
    tmp8 = tmp6 + tmp7
    tmp9 = tl.full(tmp8.shape, 0.0, tmp8.dtype)
    tmp10 = tl.where(tmp3, tmp8, tmp9)
    tmp11 = tl.load(in_out_ptr0 + x3, tmp2, other=0.0)
    tmp12 = tl.load(in_ptr0 + x1, tmp2, eviction_policy='evict_last', other=0.0
        )
    tmp13 = tmp11 + tmp12
    tmp14 = tl.where(tmp2, tmp10, tmp13)
    tmp15 = tl.full(tmp14.shape, 0.0, tmp14.dtype)
    tmp16 = tl.where(tmp2, tmp14, tmp15)
    tmp17 = tl.load(in_ptr1 + (x0 + 4096 * x2), tmp2, eviction_policy=
        'evict_last', other=0.0)
    tmp18 = tmp13 + tmp17
    tmp19 = tl.full(tmp18.shape, 0.0, tmp18.dtype)
    tmp20 = tl.where(tmp2, tmp18, tmp19)
    tmp23 = tmp21 + tmp22
    tmp24 = tl.where(tmp2, tmp20, tmp23)
    tmp25 = tl.where(tmp2, tmp16, tmp24)
    tmp26 = 0.0
    tmp27 = tmp25 > tmp26
    tmp28 = 0.01
    tmp29 = tmp25 * tmp28
    tmp30 = tl.where(tmp27, tmp25, tmp29)
    tl.store(in_out_ptr0 + x3, tmp30, None)


@triton.jit
def triton_poi_fused_avg_pool2d_reflection_pad2d_3(in_ptr0, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 73984
    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 + (4030 + -128 * tl_math.abs(-31 + tl_math.abs(-
        1 + x1)) + -2 * tl_math.abs(-31 + tl_math.abs(-1 + x0)) + 4096 * x2
        ), xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (4031 + -128 * tl_math.abs(-31 + tl_math.abs(-
        1 + x1)) + -2 * tl_math.abs(-31 + tl_math.abs(-1 + x0)) + 4096 * x2
        ), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (4094 + -128 * tl_math.abs(-31 + tl_math.abs(-
        1 + x1)) + -2 * tl_math.abs(-31 + tl_math.abs(-1 + x0)) + 4096 * x2
        ), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (4095 + -128 * tl_math.abs(-31 + tl_math.abs(-
        1 + x1)) + -2 * tl_math.abs(-31 + tl_math.abs(-1 + x0)) + 4096 * x2
        ), xmask, eviction_policy='evict_last')
    tmp2 = tmp1 + tmp0
    tmp4 = tmp3 + tmp2
    tmp6 = tmp5 + tmp4
    tmp7 = 0.25
    tmp8 = tmp6 * tmp7
    tl.store(out_ptr0 + x3, tmp8, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_reflection_pad2d_4(in_ptr0,
    in_ptr1, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 147968
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 34
    x1 = xindex // 34 % 34
    x4 = xindex // 1156
    x2 = xindex // 1156 % 32
    x5 = 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 * x4),
        xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x5, tmp7, xmask)


@triton.jit
def triton_poi_fused_add_avg_pool2d_convolution_leaky_relu_5(in_out_ptr0,
    in_ptr0, in_ptr1, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x2 = xindex // 1024 % 32
    x5 = xindex
    x0 = xindex % 32
    x3 = xindex // 32768
    x6 = xindex // 32 % 1024
    tmp18 = tl.load(in_out_ptr0 + x5, None)
    tmp19 = tl.load(in_ptr0 + x2, None, eviction_policy='evict_last')
    tmp0 = x2
    tmp1 = tl.full([1], 16, tl.int64)
    tmp2 = tmp0 < tmp1
    tmp3 = tl.load(in_out_ptr0 + x5, tmp2, other=0.0)
    tmp4 = tl.load(in_ptr0 + x2, tmp2, eviction_policy='evict_last', other=0.0)
    tmp5 = tmp3 + tmp4
    tmp6 = tl.load(in_ptr1 + (2 * x0 + 128 * x6 + 65536 * x3), tmp2,
        eviction_policy='evict_last', other=0.0)
    tmp7 = tl.load(in_ptr1 + (1 + 2 * x0 + 128 * x6 + 65536 * x3), tmp2,
        eviction_policy='evict_last', other=0.0)
    tmp8 = tmp7 + tmp6
    tmp9 = tl.load(in_ptr1 + (64 + 2 * x0 + 128 * x6 + 65536 * x3), tmp2,
        eviction_policy='evict_last', other=0.0)
    tmp10 = tmp9 + tmp8
    tmp11 = tl.load(in_ptr1 + (65 + 2 * x0 + 128 * x6 + 65536 * x3), tmp2,
        eviction_policy='evict_last', other=0.0)
    tmp12 = tmp11 + tmp10
    tmp13 = 0.25
    tmp14 = tmp12 * tmp13
    tmp15 = tmp5 + tmp14
    tmp16 = tl.full(tmp15.shape, 0.0, tmp15.dtype)
    tmp17 = tl.where(tmp2, tmp15, tmp16)
    tmp20 = tmp18 + tmp19
    tmp21 = tl.where(tmp2, tmp17, tmp20)
    tmp22 = tl.where(tmp2, tmp21, tmp21)
    tmp23 = 0.0
    tmp24 = tmp22 > tmp23
    tmp25 = 0.01
    tmp26 = tmp22 * tmp25
    tmp27 = tl.where(tmp24, tmp22, tmp26)
    tl.store(in_out_ptr0 + x5, tmp27, None)


@triton.jit
def triton_poi_fused_arange_6(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
    tl.store(out_ptr0 + x0, tmp0, xmask)


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


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


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


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


@triton.jit
def triton_poi_fused_cat_reflection_pad2d_11(in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 295936
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex // 1156 % 64
    x0 = xindex % 34
    x1 = xindex // 34 % 34
    x3 = xindex // 73984
    x5 = xindex
    tmp0 = x2
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 32, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = 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 + 
        32768 * x3), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp6 = tl.load(in_ptr1 + (1023 + -1 * tl_math.abs(-31 + tl_math.abs(-1 +
        x0)) + -32 * tl_math.abs(-31 + tl_math.abs(-1 + x1)) + 1024 * x2 + 
        32768 * x3), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp7 = tl.load(in_ptr2 + (31 + -1 * tl_math.abs(-31 + tl_math.abs(-1 +
        x1))), tmp4 & xmask, eviction_policy='evict_last', other=0.0)
    tmp8 = tmp6 * tmp7
    tmp9 = tmp5 + tmp8
    tmp10 = tl.full(tmp9.shape, 0.0, tmp9.dtype)
    tmp11 = tl.where(tmp4, tmp9, tmp10)
    tmp12 = tmp0 >= tmp3
    tl.full([1], 64, tl.int64)
    tmp15 = tl.load(in_ptr3 + (1023 + -1 * tl_math.abs(-31 + tl_math.abs(-1 +
        x0)) + -32 * tl_math.abs(-31 + tl_math.abs(-1 + x1)) + 1024 * (-32 +
        x2) + 32768 * x3), tmp12 & xmask, eviction_policy='evict_last',
        other=0.0)
    tmp16 = tl.where(tmp4, tmp11, tmp15)
    tl.store(out_ptr0 + x5, tmp16, xmask)


@triton.jit
def triton_poi_fused_add_convolution_leaky_relu_leaky_relu_backward_12(
    in_out_ptr0, 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)
    x4 = xindex
    x2 = xindex // 1024 % 32
    x3 = xindex // 32768
    x5 = xindex % 1024
    x1 = xindex // 32 % 32
    tmp0 = tl.load(in_out_ptr0 + x4, None)
    tmp1 = tl.load(in_ptr0 + x2, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = x2
    tl.full([1], 0, tl.int64)
    tmp6 = tl.full([1], 32, tl.int64)
    tmp7 = tmp3 < tmp6
    tmp8 = tl.load(in_ptr1 + (x5 + 1024 * x2 + 32768 * x3), tmp7, other=0.0)
    tmp9 = tl.load(in_ptr2 + (x5 + 1024 * x2 + 32768 * x3), tmp7, other=0.0)
    tmp10 = tl.load(in_ptr3 + x1, tmp7, eviction_policy='evict_last', other=0.0
        )
    tmp11 = tmp9 * tmp10
    tmp12 = tmp8 + tmp11
    tmp13 = tl.full(tmp12.shape, 0.0, tmp12.dtype)
    tmp14 = tl.where(tmp7, tmp12, tmp13)
    tmp15 = tmp3 >= tmp6
    tl.full([1], 64, tl.int64)
    tmp18 = tl.load(in_ptr4 + (x5 + 1024 * (-32 + x2) + 32768 * x3), tmp15,
        other=0.0)
    tmp19 = tl.where(tmp7, tmp14, tmp18)
    tmp20 = tmp2 + tmp19
    tmp21 = 0.0
    tmp22 = tmp20 > tmp21
    tmp23 = 0.01
    tmp24 = tmp20 * tmp23
    tmp25 = tl.where(tmp22, tmp20, tmp24)
    tmp26 = tmp25 > tmp21
    tl.store(in_out_ptr0 + x4, tmp20, None)
    tl.store(out_ptr0 + x4, tmp26, None)


@triton.jit
def triton_poi_fused_arange_13(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
    tl.store(out_ptr0 + x0, tmp0, xmask)


@triton.jit
def triton_poi_fused__to_copy_14(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 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp8, xmask)


@triton.jit
def triton_poi_fused_add_clamp_15(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 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 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tl.full([1], 1, tl.int64)
    tmp10 = tmp8 + tmp9
    tmp11 = tl.full([1], 31, tl.int64)
    tmp12 = triton_helpers.minimum(tmp10, tmp11)
    tl.store(out_ptr0 + x0, tmp12, xmask)


@triton.jit
def triton_poi_fused__to_copy_add_clamp_mul_sub_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 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 - tmp9
    tmp11 = triton_helpers.maximum(tmp10, tmp6)
    tmp12 = 1.0
    tmp13 = triton_helpers.minimum(tmp11, tmp12)
    tl.store(out_ptr0 + x0, tmp13, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_add_leaky_relu_mul_sub_17(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)
    x1 = xindex // 64 % 64
    x0 = xindex % 64
    x2 = xindex // 4096
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr1 + x0, None, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr3 + x0, None, eviction_policy='evict_last')
    tmp24 = tl.load(in_ptr4 + x0, None, 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_ptr2 + (tmp8 + 32 * tmp4 + 1024 * x2), None,
        eviction_policy='evict_last')
    tmp10 = 0.0
    tmp11 = tmp9 > tmp10
    tmp12 = 0.01
    tmp13 = tmp9 * tmp12
    tmp14 = tl.where(tmp11, tmp9, tmp13)
    tmp16 = tmp15 + tmp1
    tmp17 = tmp15 < 0
    tmp18 = tl.where(tmp17, tmp16, tmp15)
    tmp19 = tl.load(in_ptr2 + (tmp18 + 32 * tmp4 + 1024 * x2), None,
        eviction_policy='evict_last')
    tmp20 = tmp19 > tmp10
    tmp21 = tmp19 * tmp12
    tmp22 = tl.where(tmp20, tmp19, tmp21)
    tmp23 = tmp22 - tmp14
    tmp25 = tmp23 * tmp24
    tmp26 = tmp14 + tmp25
    tl.store(out_ptr0 + x4, tmp26, None)


@triton.jit
def triton_poi_fused_cat_18(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4,
    in_ptr5, in_ptr6, in_ptr7, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x2 = xindex // 4096 % 48
    x3 = xindex // 196608
    x4 = xindex % 4096
    x1 = xindex // 64 % 64
    x0 = xindex % 64
    x5 = xindex
    tmp0 = x2
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 32, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x4 + 4096 * x2 + 131072 * x3), tmp4, other=0.0)
    tmp6 = tl.load(in_ptr1 + x1, tmp4, eviction_policy='evict_last', other=0.0)
    tmp7 = tl.full([XBLOCK], 32, tl.int32)
    tmp8 = tmp6 + tmp7
    tmp9 = tmp6 < 0
    tmp10 = tl.where(tmp9, tmp8, tmp6)
    tmp11 = tl.load(in_ptr2 + x0, tmp4, eviction_policy='evict_last', other=0.0
        )
    tmp12 = tmp11 + tmp7
    tmp13 = tmp11 < 0
    tmp14 = tl.where(tmp13, tmp12, tmp11)
    tmp15 = tl.load(in_ptr3 + (tmp14 + 32 * tmp10 + 1024 * x2 + 32768 * x3),
        tmp4, eviction_policy='evict_last', other=0.0)
    tmp16 = 0.0
    tmp17 = tmp15 > tmp16
    tmp18 = 0.01
    tmp19 = tmp15 * tmp18
    tmp20 = tl.where(tmp17, tmp15, tmp19)
    tmp21 = tl.load(in_ptr4 + x0, tmp4, eviction_policy='evict_last', other=0.0
        )
    tmp22 = tmp21 + tmp7
    tmp23 = tmp21 < 0
    tmp24 = tl.where(tmp23, tmp22, tmp21)
    tmp25 = tl.load(in_ptr3 + (tmp24 + 32 * tmp10 + 1024 * x2 + 32768 * x3),
        tmp4, eviction_policy='evict_last', other=0.0)
    tmp26 = tmp25 > tmp16
    tmp27 = tmp25 * tmp18
    tmp28 = tl.where(tmp26, tmp25, tmp27)
    tmp29 = tmp28 - tmp20
    tmp30 = tl.load(in_ptr5 + x0, tmp4, eviction_policy='evict_last', other=0.0
        )
    tmp31 = tmp29 * tmp30
    tmp32 = tmp20 + tmp31
    tmp33 = tmp32 - tmp5
    tmp34 = tl.load(in_ptr6 + x1, tmp4, eviction_policy='evict_last', other=0.0
        )
    tmp35 = tmp33 * tmp34
    tmp36 = tmp5 + tmp35
    tmp37 = tl.full(tmp36.shape, 0.0, tmp36.dtype)
    tmp38 = tl.where(tmp4, tmp36, tmp37)
    tmp39 = tmp0 >= tmp3
    tl.full([1], 48, tl.int64)
    tmp42 = tl.load(in_ptr7 + (x4 + 4096 * (-32 + x2) + 65536 * x3), tmp39,
        other=0.0)
    tmp43 = tl.where(tmp4, tmp38, tmp42)
    tl.store(out_ptr0 + x5, tmp43, None)


@triton.jit
def triton_poi_fused_reflection_pad2d_19(in_ptr0, 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')
    tl.store(out_ptr0 + x3, tmp0, xmask)


@triton.jit
def triton_poi_fused_add_convolution_leaky_relu_20(in_out_ptr0, in_ptr0,
    in_ptr1, 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 % 16
    x2 = xindex // 65536
    x4 = xindex % 65536
    tmp0 = tl.load(in_out_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr1 + (x4 + 196608 * x2), None)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp5 = 0.0
    tmp6 = tmp4 > tmp5
    tmp7 = 0.01
    tmp8 = tmp4 * tmp7
    tmp9 = tl.where(tmp6, tmp4, tmp8)
    tl.store(in_out_ptr0 + x3, tmp9, None)


@triton.jit
def triton_poi_fused_convolution_21(in_out_ptr0, in_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_out_ptr0 + x0, None)
    tmp1 = tl.load(in_ptr0 + 0)
    tmp2 = tl.broadcast_to(tmp1, [XBLOCK])
    tmp3 = tmp0 + tmp2
    tl.store(in_out_ptr0 + x0, tmp3, None)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_22(in_ptr0,
    in_ptr1, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 4096 % 16
    tmp0 = tl.load(in_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr1 + x1, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = tmp7 > tmp3
    tl.store(out_ptr0 + x3, tmp8, None)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_23(in_ptr0,
    in_ptr1, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 1024 % 32
    tmp0 = tl.load(in_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr1 + x1, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = tmp7 > tmp3
    tl.store(out_ptr0 + x3, tmp8, 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
        ) = args
    args.clear()
    assert_size_stride(primals_1, (4, 1, 64, 64), (4096, 4096, 64, 1))
    assert_size_stride(primals_2, (16, 1, 3, 3), (9, 9, 3, 1))
    assert_size_stride(primals_3, (16,), (1,))
    assert_size_stride(primals_4, (16, 16, 3, 3), (144, 9, 3, 1))
    assert_size_stride(primals_5, (16,), (1,))
    assert_size_stride(primals_6, (32, 16, 3, 3), (144, 9, 3, 1))
    assert_size_stride(primals_7, (32,), (1,))
    assert_size_stride(primals_8, (32, 32, 3, 3), (288, 9, 3, 1))
    assert_size_stride(primals_9, (32,), (1,))
    assert_size_stride(primals_10, (32, 32, 3, 3), (288, 9, 3, 1))
    assert_size_stride(primals_11, (32,), (1,))
    assert_size_stride(primals_12, (32, 32, 3, 3), (288, 9, 3, 1))
    assert_size_stride(primals_13, (32,), (1,))
    assert_size_stride(primals_14, (32, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_15, (32,), (1,))
    assert_size_stride(primals_16, (32, 32, 3, 3), (288, 9, 3, 1))
    assert_size_stride(primals_17, (32,), (1,))
    assert_size_stride(primals_18, (16, 48, 3, 3), (432, 9, 3, 1))
    assert_size_stride(primals_19, (16,), (1,))
    assert_size_stride(primals_20, (16, 16, 3, 3), (144, 9, 3, 1))
    assert_size_stride(primals_21, (16,), (1,))
    assert_size_stride(primals_22, (1, 16, 1, 1), (16, 1, 1, 1))
    assert_size_stride(primals_23, (1,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 1, 66, 66), (4356, 4356, 66, 1),
            torch.float32)
        get_raw_stream(0)
        triton_poi_fused_reflection_pad2d_0[grid(17424)](primals_1, buf0, 
            17424, XBLOCK=128, num_warps=4, num_stages=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, 16, 64, 64), (65536, 4096, 64, 1))
        buf2 = empty_strided_cuda((4, 16, 66, 66), (69696, 4356, 66, 1),
            torch.float32)
        triton_poi_fused_convolution_leaky_relu_reflection_pad2d_1[grid(278784)
            ](buf1, primals_3, buf2, 278784, XBLOCK=1024, num_warps=4,
            num_stages=1)
        buf3 = extern_kernels.convolution(buf2, primals_4, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf3, (4, 16, 64, 64), (65536, 4096, 64, 1))
        buf4 = buf3
        del buf3
        triton_poi_fused_add_convolution_leaky_relu_2[grid(262144)](buf4,
            primals_5, primals_1, 262144, XBLOCK=512, num_warps=8, num_stages=1
            )
        del primals_1
        del primals_5
        buf5 = empty_strided_cuda((4, 16, 34, 34), (18496, 1156, 34, 1),
            torch.float32)
        triton_poi_fused_avg_pool2d_reflection_pad2d_3[grid(73984)](buf4,
            buf5, 73984, XBLOCK=1024, num_warps=4, num_stages=1)
        buf6 = extern_kernels.convolution(buf5, primals_6, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf6, (4, 32, 32, 32), (32768, 1024, 32, 1))
        buf7 = empty_strided_cuda((4, 32, 34, 34), (36992, 1156, 34, 1),
            torch.float32)
        triton_poi_fused_convolution_leaky_relu_reflection_pad2d_4[grid(147968)
            ](buf6, primals_7, buf7, 147968, XBLOCK=512, num_warps=8,
            num_stages=1)
        buf8 = extern_kernels.convolution(buf7, primals_8, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf8, (4, 32, 32, 32), (32768, 1024, 32, 1))
        buf9 = buf8
        del buf8
        buf10 = buf9
        del buf9
        triton_poi_fused_add_avg_pool2d_convolution_leaky_relu_5[grid(131072)](
            buf10, primals_9, buf4, 131072, XBLOCK=512, num_warps=8,
            num_stages=1)
        del primals_9
        buf11 = empty_strided_cuda((32,), (1,), torch.int64)
        triton_poi_fused_arange_6[grid(32)](buf11, 32, XBLOCK=32, num_warps
            =1, num_stages=1)
        buf12 = empty_strided_cuda((32, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_7[grid(32)](buf12, 32, XBLOCK=32,
            num_warps=1, num_stages=1)
        buf13 = empty_strided_cuda((32, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_8[grid(32)](buf13, 32, XBLOCK=32,
            num_warps=1, num_stages=1)
        buf14 = empty_strided_cuda((32,), (1,), torch.int64)
        triton_poi_fused__to_copy_7[grid(32)](buf14, 32, XBLOCK=32,
            num_warps=1, num_stages=1)
        buf15 = empty_strided_cuda((32,), (1,), torch.int64)
        triton_poi_fused_add_clamp_8[grid(32)](buf15, 32, XBLOCK=32,
            num_warps=1, num_stages=1)
        buf18 = empty_strided_cuda((32,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_clamp_mul_sub_9[grid(32)](buf18, 32,
            XBLOCK=32, num_warps=1, num_stages=1)
        buf17 = empty_strided_cuda((4, 32, 32, 32), (32768, 1024, 32, 1),
            torch.float32)
        buf16 = empty_strided_cuda((4, 32, 32, 32), (32768, 1024, 32, 1),
            torch.float32)
        buf19 = buf16
        del buf16
        buf21 = buf17
        del buf17
        triton_poi_fused__unsafe_index_add_avg_pool2d_mul_sub_10[grid(131072)](
            buf19, buf21, buf13, buf14, buf10, buf12, buf15, buf18, 131072,
            XBLOCK=512, num_warps=8, num_stages=1)
        buf20 = empty_strided_cuda((32, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_clamp_mul_sub_9[grid(32)](buf20, 32,
            XBLOCK=32, num_warps=1, num_stages=1)
        buf22 = empty_strided_cuda((4, 64, 34, 34), (73984, 1156, 34, 1),
            torch.float32)
        triton_poi_fused_cat_reflection_pad2d_11[grid(295936)](buf19, buf21,
            buf20, buf10, buf22, 295936, XBLOCK=1024, num_warps=4, num_stages=1
            )
        buf23 = extern_kernels.convolution(buf22, primals_14, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf23, (4, 32, 32, 32), (32768, 1024, 32, 1))
        buf24 = empty_strided_cuda((4, 32, 34, 34), (36992, 1156, 34, 1),
            torch.float32)
        triton_poi_fused_convolution_leaky_relu_reflection_pad2d_4[grid(147968)
            ](buf23, primals_15, buf24, 147968, XBLOCK=512, num_warps=8,
            num_stages=1)
        buf25 = extern_kernels.convolution(buf24, primals_16, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf25, (4, 32, 32, 32), (32768, 1024, 32, 1))
        buf26 = buf25
        del buf25
        buf44 = empty_strided_cuda((4, 32, 32, 32), (32768, 1024, 32, 1),
            torch.bool)
        triton_poi_fused_add_convolution_leaky_relu_leaky_relu_backward_12[grid
            (131072)](buf26, primals_17, buf19, buf21, buf20, buf10, buf44,
            131072, XBLOCK=512, num_warps=8, num_stages=1)
        del buf19
        del buf21
        del primals_17
        buf27 = empty_strided_cuda((64,), (1,), torch.int64)
        triton_poi_fused_arange_13[grid(64)](buf27, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf28 = empty_strided_cuda((64, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_14[grid(64)](buf28, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf29 = empty_strided_cuda((64, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_15[grid(64)](buf29, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf30 = empty_strided_cuda((64,), (1,), torch.int64)
        triton_poi_fused__to_copy_14[grid(64)](buf30, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf31 = empty_strided_cuda((64,), (1,), torch.int64)
        triton_poi_fused_add_clamp_15[grid(64)](buf31, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf32 = empty_strided_cuda((64,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_clamp_mul_sub_16[grid(64)](buf32, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        buf33 = empty_strided_cuda((4, 32, 64, 64), (131072, 4096, 64, 1),
            torch.float32)
        triton_poi_fused__unsafe_index_add_leaky_relu_mul_sub_17[grid(524288)](
            buf28, buf30, buf26, buf31, buf32, buf33, 524288, XBLOCK=1024,
            num_warps=4, num_stages=1)
        buf34 = empty_strided_cuda((64, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_clamp_mul_sub_16[grid(64)](buf34, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        buf35 = empty_strided_cuda((4, 48, 64, 64), (196608, 4096, 64, 1),
            torch.float32)
        triton_poi_fused_cat_18[grid(786432)](buf33, buf29, buf30, buf26,
            buf31, buf32, buf34, buf4, buf35, 786432, XBLOCK=512, num_warps
            =8, num_stages=1)
        del buf26
        del buf33
        buf36 = empty_strided_cuda((4, 48, 66, 66), (209088, 4356, 66, 1),
            torch.float32)
        triton_poi_fused_reflection_pad2d_19[grid(836352)](buf35, buf36, 
            836352, XBLOCK=1024, num_warps=4, num_stages=1)
        buf37 = extern_kernels.convolution(buf36, primals_18, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf37, (4, 16, 64, 64), (65536, 4096, 64, 1))
        buf38 = empty_strided_cuda((4, 16, 66, 66), (69696, 4356, 66, 1),
            torch.float32)
        triton_poi_fused_convolution_leaky_relu_reflection_pad2d_1[grid(278784)
            ](buf37, primals_19, buf38, 278784, XBLOCK=1024, num_warps=4,
            num_stages=1)
        buf39 = extern_kernels.convolution(buf38, primals_20, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf39, (4, 16, 64, 64), (65536, 4096, 64, 1))
        buf40 = buf39
        del buf39
        triton_poi_fused_add_convolution_leaky_relu_20[grid(262144)](buf40,
            primals_21, buf35, 262144, XBLOCK=512, num_warps=8, num_stages=1)
        del buf35
        del primals_21
        buf41 = extern_kernels.convolution(buf40, primals_22, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf41, (4, 1, 64, 64), (4096, 4096, 64, 1))
        buf42 = buf41
        del buf41
        triton_poi_fused_convolution_21[grid(16384)](buf42, primals_23, 
            16384, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_23
        buf43 = empty_strided_cuda((4, 16, 64, 64), (65536, 4096, 64, 1),
            torch.bool)
        triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_22[grid
            (262144)](buf37, primals_19, buf43, 262144, XBLOCK=1024,
            num_warps=4, num_stages=1)
        del buf37
        del primals_19
        buf45 = empty_strided_cuda((4, 32, 32, 32), (32768, 1024, 32, 1),
            torch.bool)
        triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_23[grid
            (131072)](buf23, primals_15, buf45, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        del buf23
        del primals_15
        buf46 = empty_strided_cuda((4, 32, 32, 32), (32768, 1024, 32, 1),
            torch.bool)
        triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_23[grid
            (131072)](buf6, primals_7, buf46, 131072, XBLOCK=512, num_warps
            =8, num_stages=1)
        del buf6
        del primals_7
        buf47 = empty_strided_cuda((4, 16, 64, 64), (65536, 4096, 64, 1),
            torch.bool)
        triton_poi_fused_convolution_leaky_relu_leaky_relu_backward_22[grid
            (262144)](buf1, primals_3, buf47, 262144, XBLOCK=1024,
            num_warps=4, num_stages=1)
        del buf1
        del primals_3
    return (buf42, primals_2, primals_4, primals_6, primals_8, primals_14,
        primals_16, primals_18, primals_20, primals_22, buf0, buf2, buf4,
        buf5, buf7, buf10, buf11, buf12, buf13, buf14, buf15, buf18, buf20,
        buf22, buf24, buf27, buf28, buf29, buf30, buf31, buf32, buf34,
        buf36, buf38, buf40, buf43, buf44, buf45, buf46, buf47)


class ConvBlock(nn.Module):

    def __init__(self, in_channels, out_channels, dropout=False, norm=None,
        residual=True, activation='leakyrelu', in_place_activation=True,
        transpose=False, reflectpad=True):
        super(ConvBlock, self).__init__()
        self.dropout = dropout
        self.residual = residual
        self.activation = activation
        self.transpose = transpose
        self.reflectpad = reflectpad
        if self.dropout:
            self.dropout1 = nn.Dropout2d(p=0.05)
            self.dropout2 = nn.Dropout2d(p=0.05)
        self.norm1 = None
        self.norm2 = None
        if norm is not None:
            if norm == 'batch':
                self.norm1 = nn.BatchNorm2d(out_channels)
                self.norm2 = nn.BatchNorm2d(out_channels)
            elif norm == 'instance':
                self.norm1 = nn.InstanceNorm2d(out_channels, affine=True)
                self.norm2 = nn.InstanceNorm2d(out_channels, affine=True)
        if self.transpose:
            self.conv1 = nn.ConvTranspose2d(in_channels, out_channels,
                kernel_size=3, padding=0 if self.reflectpad else 1)
            self.conv2 = nn.ConvTranspose2d(out_channels, out_channels,
                kernel_size=3, padding=0 if self.reflectpad else 1)
        else:
            self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3,
                padding=0 if self.reflectpad else 1)
            self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=
                3, padding=0 if self.reflectpad else 1)
        if self.activation == 'relu':
            self.actfun1 = nn.ReLU(inplace=in_place_activation)
            self.actfun2 = nn.ReLU(inplace=in_place_activation)
        elif self.activation == 'leakyrelu':
            self.actfun1 = nn.LeakyReLU(inplace=in_place_activation)
            self.actfun2 = nn.LeakyReLU(inplace=in_place_activation)
        elif self.activation == 'elu':
            self.actfun1 = nn.ELU(inplace=in_place_activation)
            self.actfun2 = nn.ELU(inplace=in_place_activation)
        elif self.activation == 'selu':
            self.actfun1 = nn.SELU(inplace=in_place_activation)
            self.actfun2 = nn.SELU(inplace=in_place_activation)
        if self.reflectpad:
            self.rpad1 = nn.ReflectionPad2d(1)
            self.rpad2 = nn.ReflectionPad2d(1)

    def forward(self, x):
        ox = x
        if self.reflectpad:
            x = self.rpad1(x)
        x = self.conv1(x)
        if self.dropout:
            x = self.dropout1(x)
        x = self.actfun1(x)
        if self.norm1:
            x = self.norm1(x)
        if self.reflectpad:
            x = self.rpad2(x)
        x = self.conv2(x)
        if self.dropout:
            x = self.dropout2(x)
        if self.residual:
            x[:, 0:min(ox.shape[1], x.shape[1]), :, :] += ox[:, 0:min(ox.
                shape[1], x.shape[1]), :, :]
        x = self.actfun2(x)
        if self.norm2:
            x = self.norm2(x)
        return x


class BabyUnetNew(nn.Module):

    def __init__(self, n_channel_in=1, n_channel_out=1):
        super(BabyUnetNew, self).__init__()
        self.pool1 = nn.AvgPool2d(kernel_size=2)
        self.pool2 = nn.AvgPool2d(kernel_size=2)
        self.up1 = lambda x: F.interpolate(x, mode='bilinear', scale_factor=2)
        self.up2 = lambda x: F.interpolate(x, mode='bilinear', scale_factor=2)
        self.conv1 = ConvBlock(n_channel_in, 16)
        self.conv2 = ConvBlock(16, 32)
        self.conv3 = ConvBlock(32, 32)
        self.conv4 = ConvBlock(64, 32)
        self.conv5 = ConvBlock(48, 16)
        self.conv6 = nn.Conv2d(16, n_channel_out, 1)

    def forward(self, input_0):
        primals_2 = self.conv1.conv1.weight
        primals_3 = self.conv1.conv1.bias
        primals_4 = self.conv1.conv2.weight
        primals_5 = self.conv1.conv2.bias
        primals_6 = self.conv2.conv1.weight
        primals_7 = self.conv2.conv1.bias
        primals_8 = self.conv2.conv2.weight
        primals_9 = self.conv2.conv2.bias
        primals_10 = self.conv3.conv1.weight
        primals_11 = self.conv3.conv1.bias
        primals_12 = self.conv3.conv2.weight
        primals_13 = self.conv3.conv2.bias
        primals_14 = self.conv4.conv1.weight
        primals_15 = self.conv4.conv1.bias
        primals_16 = self.conv4.conv2.weight
        primals_17 = self.conv4.conv2.bias
        primals_18 = self.conv5.conv1.weight
        primals_19 = self.conv5.conv1.bias
        primals_20 = self.conv5.conv2.weight
        primals_21 = self.conv5.conv2.bias
        primals_22 = self.conv6.weight
        primals_23 = self.conv6.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])
        return output[0]
