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
import torch.nn as nn
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_0(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    ynumel = 4288
    xnumel = 9
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y3 = yindex
    y0 = yindex % 67
    y1 = yindex // 67
    tmp0 = tl.load(in_ptr0 + (x2 + 9 * y3), xmask & ymask, eviction_policy=
        'evict_last')
    tl.store(out_ptr0 + (y0 + 67 * x2 + 603 * y1), tmp0, xmask & ymask)


@triton.jit
def triton_poi_fused_cat_1(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x2 = xindex // 4096 % 66
    x3 = xindex // 270336
    x4 = xindex % 4096
    x1 = xindex // 64 % 64
    x0 = xindex % 64
    x5 = xindex % 270336
    tmp0 = x2
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 64, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x4 + 4096 * x2 + 262144 * x3), tmp4, other=0.0)
    tmp6 = tmp0 >= tmp3
    tmp7 = tl.full([1], 65, tl.int64)
    tmp8 = tmp0 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = x1
    tmp11 = tmp10.to(tl.float32)
    tmp12 = 0.015873015873015872
    tmp13 = tmp11 * tmp12
    tmp14 = 2.0
    tmp15 = tmp13 * tmp14
    tmp16 = 1.0
    tmp17 = tmp15 - tmp16
    tmp18 = tl.full(tmp17.shape, 0.0, tmp17.dtype)
    tmp19 = tl.where(tmp9, tmp17, tmp18)
    tmp20 = tmp0 >= tmp7
    tl.full([1], 66, tl.int64)
    tmp23 = x0
    tmp24 = tmp23.to(tl.float32)
    tmp25 = tmp24 * tmp12
    tmp26 = tmp25 * tmp14
    tmp27 = tmp26 - tmp16
    tmp28 = tl.full(tmp27.shape, 0.0, tmp27.dtype)
    tmp29 = tl.where(tmp20, tmp27, tmp28)
    tmp30 = tl.where(tmp9, tmp19, tmp29)
    tmp31 = tl.where(tmp4, tmp5, tmp30)
    tl.store(out_ptr0 + (x5 + 274432 * x3), tmp31, None)


@triton.jit
def triton_poi_fused__to_copy_add_pow_sqrt_sub_2(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
    x3 = xindex % 4096
    tmp0 = x1
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.015873015873015872
    tmp3 = tmp1 * tmp2
    tmp4 = 2.0
    tmp5 = tmp3 * tmp4
    tmp6 = 1.0
    tmp7 = tmp5 - tmp6
    tmp8 = 0.5
    tmp9 = tmp7 - tmp8
    tmp10 = tmp9 * tmp9
    tmp11 = x0
    tmp12 = tmp11.to(tl.float32)
    tmp13 = tmp12 * tmp2
    tmp14 = tmp13 * tmp4
    tmp15 = tmp14 - tmp6
    tmp16 = tmp15 - tmp8
    tmp17 = tmp16 * tmp16
    tmp18 = tmp10 + tmp17
    tmp19 = libdevice.sqrt(tmp18)
    tl.store(out_ptr0 + (x3 + 274432 * x2), tmp19, None)


@triton.jit
def triton_poi_fused_cat_3(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    ynumel = 268
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    tl.full([XBLOCK, YBLOCK], True, tl.int1)
    x2 = xindex
    y3 = yindex
    y0 = yindex % 67
    y1 = yindex // 67
    tmp0 = tl.load(in_ptr0 + (x2 + 4096 * y3), ymask, eviction_policy=
        'evict_last')
    tl.store(out_ptr0 + (y0 + 67 * x2 + 274432 * y1), tmp0, ymask)


@triton.jit
def triton_poi_fused_convolution_4(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)
    x2 = xindex
    x0 = xindex % 64
    tmp0 = tl.load(in_out_ptr0 + x2, None)
    tmp1 = tl.load(in_ptr0 + x0, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x2, tmp2, None)


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


@triton.jit
def triton_red_fused__native_batch_norm_legit_6(in_out_ptr0, in_ptr0,
    out_ptr0, xnumel, rnumel, XBLOCK: tl.constexpr, RBLOCK: tl.constexpr):
    xnumel = 256
    rnumel = 4096
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rbase = tl.arange(0, RBLOCK)[None, :]
    x0 = xindex
    tmp2_mean = tl.zeros([XBLOCK, RBLOCK], tl.float32)
    tmp2_m2 = tl.zeros([XBLOCK, RBLOCK], tl.float32)
    tmp2_weight = tl.zeros([XBLOCK, RBLOCK], tl.float32)
    for roffset in range(0, rnumel, RBLOCK):
        rindex = roffset + rbase
        rmask = rindex < rnumel
        r1 = rindex
        tmp0 = tl.load(in_ptr0 + (64 * r1 + 262144 * (x0 // 64) + x0 % 64),
            rmask & xmask, eviction_policy='evict_first', other=0.0)
        tmp1 = tl.broadcast_to(tmp0, [XBLOCK, RBLOCK])
        tmp2_mean_next, tmp2_m2_next, tmp2_weight_next = (triton_helpers.
            welford_reduce(tmp1, tmp2_mean, tmp2_m2, tmp2_weight, roffset == 0)
            )
        tmp2_mean = tl.where(rmask & xmask, tmp2_mean_next, tmp2_mean)
        tmp2_m2 = tl.where(rmask & xmask, tmp2_m2_next, tmp2_m2)
        tmp2_weight = tl.where(rmask & xmask, tmp2_weight_next, tmp2_weight)
    tmp2_tmp, tmp3_tmp, tmp4_tmp = triton_helpers.welford(tmp2_mean,
        tmp2_m2, tmp2_weight, 1)
    tmp2 = tmp2_tmp[:, None]
    tmp3 = tmp3_tmp[:, None]
    tmp4_tmp[:, None]
    tl.store(out_ptr0 + x0, tmp2, xmask)
    tmp5 = 4096.0
    tmp6 = tmp3 / tmp5
    tmp7 = 1e-05
    tmp8 = tmp6 + tmp7
    tmp9 = libdevice.rsqrt(tmp8)
    tl.debug_barrier()
    tl.store(in_out_ptr0 + x0, tmp9, xmask)


@triton.jit
def triton_poi_fused__native_batch_norm_legit_7(in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, in_ptr4, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex % 256
    x1 = xindex // 256
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (64 * x1 + 262144 * (x0 // 64) + x0 % 64), None)
    tmp1 = tl.load(in_ptr1 + x0, None, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x0, None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr3 + x0, None, eviction_policy='evict_last')
    tmp7 = tl.load(in_ptr4 + x0, None, eviction_policy='evict_last')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp6 = tmp4 * tmp5
    tmp8 = tmp6 + tmp7
    tl.store(out_ptr0 + x2, tmp8, None)


@triton.jit
def triton_poi_fused_cat_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)
    x2 = xindex // 4096 % 66
    x3 = xindex // 270336
    x4 = xindex % 4096
    x1 = xindex // 64 % 64
    x0 = xindex % 64
    x5 = xindex % 270336
    tmp0 = x2
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 64, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (64 * ((64 * x3 + x2) // 64 % 4) + 256 * x4 + 
        x2 % 64), tmp4, eviction_policy='evict_last', other=0.0)
    tmp6 = 0.0
    tmp7 = tmp5 > tmp6
    tmp8 = 0.2
    tmp9 = tmp5 * tmp8
    tmp10 = tl.where(tmp7, tmp5, tmp9)
    tmp11 = tl.full(tmp10.shape, 0.0, tmp10.dtype)
    tmp12 = tl.where(tmp4, tmp10, tmp11)
    tmp13 = tmp0 >= tmp3
    tmp14 = tl.full([1], 65, tl.int64)
    tmp15 = tmp0 < tmp14
    tmp16 = tmp13 & tmp15
    tmp17 = x1
    tmp18 = tmp17.to(tl.float32)
    tmp19 = 0.015873015873015872
    tmp20 = tmp18 * tmp19
    tmp21 = 2.0
    tmp22 = tmp20 * tmp21
    tmp23 = 1.0
    tmp24 = tmp22 - tmp23
    tmp25 = tl.full(tmp24.shape, 0.0, tmp24.dtype)
    tmp26 = tl.where(tmp16, tmp24, tmp25)
    tmp27 = tmp0 >= tmp14
    tl.full([1], 66, tl.int64)
    tmp30 = x0
    tmp31 = tmp30.to(tl.float32)
    tmp32 = tmp31 * tmp19
    tmp33 = tmp32 * tmp21
    tmp34 = tmp33 - tmp23
    tmp35 = tl.full(tmp34.shape, 0.0, tmp34.dtype)
    tmp36 = tl.where(tmp27, tmp34, tmp35)
    tmp37 = tl.where(tmp16, tmp26, tmp36)
    tmp38 = tl.where(tmp4, tmp12, tmp37)
    tl.store(out_ptr0 + (x5 + 274432 * x3), tmp38, None)


@triton.jit
def triton_red_fused__native_batch_norm_legit_add_repeat_9(in_ptr0, in_ptr1,
    in_ptr2, in_ptr3, out_ptr0, out_ptr1, out_ptr3, out_ptr4, xnumel,
    rnumel, XBLOCK: tl.constexpr, RBLOCK: tl.constexpr):
    xnumel = 256
    rnumel = 4096
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rbase = tl.arange(0, RBLOCK)[None, :]
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0 % 64, xmask, eviction_policy='evict_last')
    tl.store(out_ptr0 + x0, tmp0, xmask)
    tmp3_mean = tl.zeros([XBLOCK, RBLOCK], tl.float32)
    tmp3_m2 = tl.zeros([XBLOCK, RBLOCK], tl.float32)
    tmp3_weight = tl.zeros([XBLOCK, RBLOCK], tl.float32)
    for roffset in range(0, rnumel, RBLOCK):
        rindex = roffset + rbase
        rmask = rindex < rnumel
        r1 = rindex
        tmp1 = tl.load(in_ptr1 + (64 * r1 + 262144 * (x0 // 64) + x0 % 64),
            rmask & xmask, eviction_policy='evict_last', other=0.0)
        tmp2 = tl.broadcast_to(tmp1, [XBLOCK, RBLOCK])
        tmp3_mean_next, tmp3_m2_next, tmp3_weight_next = (triton_helpers.
            welford_reduce(tmp2, tmp3_mean, tmp3_m2, tmp3_weight, roffset == 0)
            )
        tmp3_mean = tl.where(rmask & xmask, tmp3_mean_next, tmp3_mean)
        tmp3_m2 = tl.where(rmask & xmask, tmp3_m2_next, tmp3_m2)
        tmp3_weight = tl.where(rmask & xmask, tmp3_weight_next, tmp3_weight)
    tmp3_tmp, tmp4_tmp, tmp5_tmp = triton_helpers.welford(tmp3_mean,
        tmp3_m2, tmp3_weight, 1)
    tmp3 = tmp3_tmp[:, None]
    tmp4 = tmp4_tmp[:, None]
    tmp5_tmp[:, None]
    tl.store(out_ptr1 + x0, tmp3, xmask)
    tmp6 = 4096.0
    tmp7 = tmp4 / tmp6
    tmp8 = 1e-05
    tmp9 = tmp7 + tmp8
    tmp10 = libdevice.rsqrt(tmp9)
    tl.store(out_ptr3 + x0, tmp10, xmask)
    x2 = xindex % 64
    x3 = xindex // 64
    tmp15 = tl.load(in_ptr2 + x2, xmask, eviction_policy='evict_last')
    for roffset in range(0, rnumel, RBLOCK):
        rindex = roffset + rbase
        rmask = rindex < rnumel
        r1 = rindex
        tmp11 = tl.load(in_ptr1 + (x2 + 64 * r1 + 262144 * x3), rmask &
            xmask, eviction_policy='evict_first', other=0.0)
        tmp17 = tl.load(in_ptr3 + (r1 + 4096 * x0), rmask & xmask,
            eviction_policy='evict_first', other=0.0)
        tmp12 = tmp11 - tmp3
        tmp13 = tmp12 * tmp10
        tmp14 = tmp13 * tmp0
        tmp16 = tmp14 + tmp15
        tmp18 = tmp16 + tmp17
        tl.store(out_ptr4 + (r1 + 4096 * x0), tmp18, rmask & xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9) = args
    args.clear()
    assert_size_stride(primals_1, (4, 64, 64, 64), (262144, 4096, 64, 1))
    assert_size_stride(primals_2, (64, 67, 3, 3), (603, 9, 3, 1))
    assert_size_stride(primals_3, (64,), (1,))
    assert_size_stride(primals_4, (64,), (1,))
    assert_size_stride(primals_5, (64,), (1,))
    assert_size_stride(primals_6, (64, 67, 3, 3), (603, 9, 3, 1))
    assert_size_stride(primals_7, (64,), (1,))
    assert_size_stride(primals_8, (64,), (1,))
    assert_size_stride(primals_9, (64,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((64, 67, 3, 3), (603, 1, 201, 67), torch.
            float32)
        get_raw_stream(0)
        triton_poi_fused_0[grid(4288, 9)](primals_2, buf0, 4288, 9, XBLOCK=
            16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_2
        buf1 = empty_strided_cuda((64, 67, 3, 3), (603, 1, 201, 67), torch.
            float32)
        triton_poi_fused_0[grid(4288, 9)](primals_6, buf1, 4288, 9, XBLOCK=
            16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_6
        buf4 = empty_strided_cuda((4, 67, 64, 64), (274432, 4096, 64, 1),
            torch.float32)
        buf2 = reinterpret_tensor(buf4, (4, 66, 64, 64), (274432, 4096, 64,
            1), 0)
        triton_poi_fused_cat_1[grid(1081344)](primals_1, buf2, 1081344,
            XBLOCK=512, num_warps=8, num_stages=1)
        buf3 = reinterpret_tensor(buf4, (4, 1, 64, 64), (274432, 4096, 64, 
            1), 270336)
        triton_poi_fused__to_copy_add_pow_sqrt_sub_2[grid(16384)](buf3, 
            16384, XBLOCK=128, num_warps=4, num_stages=1)
        buf5 = empty_strided_cuda((4, 67, 64, 64), (274432, 1, 4288, 67),
            torch.float32)
        triton_poi_fused_cat_3[grid(268, 4096)](buf4, buf5, 268, 4096,
            XBLOCK=32, YBLOCK=32, num_warps=4, num_stages=1)
        del buf2
        del buf3
        buf6 = extern_kernels.convolution(buf5, buf0, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf6, (4, 64, 64, 64), (262144, 1, 4096, 64))
        buf7 = buf6
        del buf6
        triton_poi_fused_convolution_4[grid(1048576)](buf7, primals_3, 
            1048576, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_3
        buf8 = empty_strided_cuda((256,), (1,), torch.float32)
        triton_poi_fused_repeat_5[grid(256)](primals_4, buf8, 256, XBLOCK=
            256, num_warps=4, num_stages=1)
        del primals_4
        buf9 = empty_strided_cuda((256,), (1,), torch.float32)
        triton_poi_fused_repeat_5[grid(256)](primals_5, buf9, 256, XBLOCK=
            256, num_warps=4, num_stages=1)
        del primals_5
        buf10 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf11 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf13 = buf11
        del buf11
        triton_red_fused__native_batch_norm_legit_6[grid(256)](buf13, buf7,
            buf10, 256, 4096, XBLOCK=1, RBLOCK=2048, num_warps=16, num_stages=1
            )
        buf14 = empty_strided_cuda((1, 256, 64, 64), (1048576, 1, 16384, 
            256), torch.float32)
        triton_poi_fused__native_batch_norm_legit_7[grid(1048576)](buf7,
            buf10, buf13, buf8, buf9, buf14, 1048576, XBLOCK=1024,
            num_warps=4, num_stages=1)
        buf17 = buf4
        del buf4
        buf15 = reinterpret_tensor(buf17, (4, 66, 64, 64), (274432, 4096, 
            64, 1), 0)
        triton_poi_fused_cat_8[grid(1081344)](buf14, buf15, 1081344, XBLOCK
            =512, num_warps=8, num_stages=1)
        buf16 = reinterpret_tensor(buf17, (4, 1, 64, 64), (274432, 4096, 64,
            1), 270336)
        triton_poi_fused__to_copy_add_pow_sqrt_sub_2[grid(16384)](buf16, 
            16384, XBLOCK=128, num_warps=4, num_stages=1)
        buf18 = empty_strided_cuda((4, 67, 64, 64), (274432, 1, 4288, 67),
            torch.float32)
        triton_poi_fused_cat_3[grid(268, 4096)](buf17, buf18, 268, 4096,
            XBLOCK=32, YBLOCK=32, num_warps=4, num_stages=1)
        del buf15
        del buf16
        del buf17
        buf19 = extern_kernels.convolution(buf18, buf1, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf19, (4, 64, 64, 64), (262144, 1, 4096, 64))
        buf20 = buf19
        del buf19
        triton_poi_fused_convolution_4[grid(1048576)](buf20, primals_7, 
            1048576, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_7
        buf21 = empty_strided_cuda((256,), (1,), torch.float32)
        buf22 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf25 = empty_strided_cuda((1, 256, 1, 1), (256, 1, 256, 256),
            torch.float32)
        buf26 = reinterpret_tensor(buf14, (4, 64, 64, 64), (262144, 4096, 
            64, 1), 0)
        del buf14
        triton_red_fused__native_batch_norm_legit_add_repeat_9[grid(256)](
            primals_8, buf20, primals_9, primals_1, buf21, buf22, buf25,
            buf26, 256, 4096, XBLOCK=8, RBLOCK=512, num_warps=16, num_stages=1)
        del primals_1
        del primals_8
        del primals_9
    return (buf26, buf0, buf1, buf5, buf7, buf8, buf9, buf10, buf13, buf18,
        buf20, buf21, reinterpret_tensor(buf25, (256,), (1,), 0),
        reinterpret_tensor(buf22, (1, 256, 1, 1), (256, 1, 1, 1), 0))


class AddCoords(nn.Module):

    def __init__(self, with_r=False):
        super().__init__()
        self.with_r = with_r

    def forward(self, input_tensor):
        """
        @param input_tensor: shape(batch, channel, x_dim, y_dim)
        """
        batch_size, _, x_dim, y_dim = input_tensor.size()
        xx_channel = torch.arange(x_dim).repeat(1, y_dim, 1)
        yy_channel = torch.arange(y_dim).repeat(1, x_dim, 1).transpose(1, 2)
        xx_channel = xx_channel.float() / (x_dim - 1)
        yy_channel = yy_channel.float() / (y_dim - 1)
        xx_channel = xx_channel * 2 - 1
        yy_channel = yy_channel * 2 - 1
        xx_channel = xx_channel.repeat(batch_size, 1, 1, 1).transpose(2, 3)
        yy_channel = yy_channel.repeat(batch_size, 1, 1, 1).transpose(2, 3)
        ret = torch.cat([input_tensor, xx_channel.type_as(input_tensor),
            yy_channel.type_as(input_tensor)], dim=1)
        if self.with_r:
            rr = torch.sqrt(torch.pow(xx_channel.type_as(input_tensor) - 
                0.5, 2) + torch.pow(yy_channel.type_as(input_tensor) - 0.5, 2))
            ret = torch.cat([ret, rr], dim=1)
        return ret


class CoordConv(nn.Module):

    def __init__(self, in_channels, out_channels, with_r=False, **kwargs):
        super().__init__()
        self.addcoords = AddCoords(with_r=with_r)
        in_size = in_channels + 2
        if with_r:
            in_size += 1
        self.conv = nn.Conv2d(in_size, out_channels, **kwargs)

    def forward(self, x):
        ret = self.addcoords(x)
        ret = self.conv(ret)
        return ret


class Residual_BlockNew(nn.Module):

    def __init__(self):
        super(Residual_BlockNew, self).__init__()
        self.conv1 = CoordConv(in_channels=64, out_channels=64, with_r=True,
            kernel_size=3, stride=1, padding=1, bias=True)
        self.in1 = nn.InstanceNorm2d(64, affine=True)
        self.relu = nn.LeakyReLU(0.2, inplace=True)
        self.conv2 = CoordConv(in_channels=64, out_channels=64, with_r=True,
            kernel_size=3, stride=1, padding=1, bias=True)
        self.in2 = nn.InstanceNorm2d(64, affine=True)

    def forward(self, input_0):
        primals_2 = self.conv1.conv.weight
        primals_3 = self.conv1.conv.bias
        primals_4 = self.in1.weight
        primals_5 = self.in1.bias
        primals_6 = self.conv2.conv.weight
        primals_7 = self.conv2.conv.bias
        primals_8 = self.in2.weight
        primals_9 = self.in2.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])
        return output[0]


Measured latency_ms: 0.33152