import torch
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
from torch import nn
import torch.utils.data
import torch
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__to_copy__unsafe_index_add_arange_clamp_floor_mul_rsub_sub_0(
    in_out_ptr1, in_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 4 % 4
    x0 = xindex % 4
    x2 = xindex // 16
    x4 = xindex
    tmp0 = x1
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 1.0
    tmp3 = tmp1 * tmp2
    tmp4 = libdevice.floor(tmp3)
    tmp5 = tmp4.to(tl.int32)
    tmp6 = tl.full([1], 1, tl.int64)
    tmp7 = tmp5 - tmp6
    tmp8 = tl.full([1], 0, tl.int64)
    tmp9 = triton_helpers.maximum(tmp7, tmp8)
    tmp10 = tl.full([1], 3, tl.int64)
    tmp11 = triton_helpers.minimum(tmp9, tmp10)
    tmp12 = x0
    tmp13 = tmp12.to(tl.float32)
    tmp14 = tmp13 * tmp2
    tmp15 = libdevice.floor(tmp14)
    tmp16 = tmp15.to(tl.int32)
    tmp17 = tmp16 - tmp6
    tmp18 = triton_helpers.maximum(tmp17, tmp8)
    tmp19 = triton_helpers.minimum(tmp18, tmp10)
    tmp20 = tl.load(in_ptr0 + (tmp19 + 4 * tmp11 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp21 = tmp14 - tmp15
    tmp22 = 0.0
    tmp23 = triton_helpers.maximum(tmp21, tmp22)
    tmp24 = triton_helpers.minimum(tmp23, tmp2)
    tmp25 = tmp24 + tmp2
    tmp26 = -0.75
    tmp27 = tmp25 * tmp26
    tmp28 = -3.75
    tmp29 = tmp27 - tmp28
    tmp30 = tmp29 * tmp25
    tmp31 = -6.0
    tmp32 = tmp30 + tmp31
    tmp33 = tmp32 * tmp25
    tmp34 = -3.0
    tmp35 = tmp33 - tmp34
    tmp36 = tmp20 * tmp35
    tmp37 = triton_helpers.maximum(tmp16, tmp8)
    tmp38 = triton_helpers.minimum(tmp37, tmp10)
    tmp39 = tl.load(in_ptr0 + (tmp38 + 4 * tmp11 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp40 = 1.25
    tmp41 = tmp24 * tmp40
    tmp42 = 2.25
    tmp43 = tmp41 - tmp42
    tmp44 = tmp43 * tmp24
    tmp45 = tmp44 * tmp24
    tmp46 = tmp45 + tmp2
    tmp47 = tmp39 * tmp46
    tmp48 = tmp16 + tmp6
    tmp49 = triton_helpers.maximum(tmp48, tmp8)
    tmp50 = triton_helpers.minimum(tmp49, tmp10)
    tmp51 = tl.load(in_ptr0 + (tmp50 + 4 * tmp11 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp52 = tmp2 - tmp24
    tmp53 = tmp52 * tmp40
    tmp54 = tmp53 - tmp42
    tmp55 = tmp54 * tmp52
    tmp56 = tmp55 * tmp52
    tmp57 = tmp56 + tmp2
    tmp58 = tmp51 * tmp57
    tmp59 = tl.full([1], 2, tl.int64)
    tmp60 = tmp16 + tmp59
    tmp61 = triton_helpers.maximum(tmp60, tmp8)
    tmp62 = triton_helpers.minimum(tmp61, tmp10)
    tmp63 = tl.load(in_ptr0 + (tmp62 + 4 * tmp11 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp64 = 2.0
    tmp65 = tmp64 - tmp24
    tmp66 = tmp65 * tmp26
    tmp67 = tmp66 - tmp28
    tmp68 = tmp67 * tmp65
    tmp69 = tmp68 + tmp31
    tmp70 = tmp69 * tmp65
    tmp71 = tmp70 - tmp34
    tmp72 = tmp63 * tmp71
    tmp73 = triton_helpers.maximum(tmp5, tmp8)
    tmp74 = triton_helpers.minimum(tmp73, tmp10)
    tmp75 = tl.load(in_ptr0 + (tmp19 + 4 * tmp74 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp76 = tmp75 * tmp35
    tmp77 = tl.load(in_ptr0 + (tmp38 + 4 * tmp74 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp78 = tmp77 * tmp46
    tmp79 = tl.load(in_ptr0 + (tmp50 + 4 * tmp74 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp80 = tmp79 * tmp57
    tmp81 = tl.load(in_ptr0 + (tmp62 + 4 * tmp74 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp82 = tmp81 * tmp71
    tmp83 = tmp36 + tmp47
    tmp84 = tmp83 + tmp58
    tmp85 = tmp84 + tmp72
    tmp86 = tmp3 - tmp4
    tmp87 = triton_helpers.maximum(tmp86, tmp22)
    tmp88 = triton_helpers.minimum(tmp87, tmp2)
    tmp89 = tmp88 + tmp2
    tmp90 = tmp89 * tmp26
    tmp91 = tmp90 - tmp28
    tmp92 = tmp91 * tmp89
    tmp93 = tmp92 + tmp31
    tmp94 = tmp93 * tmp89
    tmp95 = tmp94 - tmp34
    tmp96 = tmp85 * tmp95
    tmp97 = tmp76 + tmp78
    tmp98 = tmp97 + tmp80
    tmp99 = tmp98 + tmp82
    tmp100 = tmp88 * tmp40
    tmp101 = tmp100 - tmp42
    tmp102 = tmp101 * tmp88
    tmp103 = tmp102 * tmp88
    tmp104 = tmp103 + tmp2
    tmp105 = tmp99 * tmp104
    tmp106 = tmp96 + tmp105
    tmp107 = tmp5 + tmp6
    tmp108 = triton_helpers.maximum(tmp107, tmp8)
    tmp109 = triton_helpers.minimum(tmp108, tmp10)
    tmp110 = tl.load(in_ptr0 + (tmp19 + 4 * tmp109 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp111 = tmp110 * tmp35
    tmp112 = tl.load(in_ptr0 + (tmp38 + 4 * tmp109 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp113 = tmp112 * tmp46
    tmp114 = tl.load(in_ptr0 + (tmp50 + 4 * tmp109 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp115 = tmp114 * tmp57
    tmp116 = tl.load(in_ptr0 + (tmp62 + 4 * tmp109 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp117 = tmp116 * tmp71
    tmp118 = tmp5 + tmp59
    tmp119 = triton_helpers.maximum(tmp118, tmp8)
    tmp120 = triton_helpers.minimum(tmp119, tmp10)
    tmp121 = tl.load(in_ptr0 + (tmp19 + 4 * tmp120 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp122 = tmp121 * tmp35
    tmp123 = tl.load(in_ptr0 + (tmp38 + 4 * tmp120 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp124 = tmp123 * tmp46
    tmp125 = tl.load(in_ptr0 + (tmp50 + 4 * tmp120 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp126 = tmp125 * tmp57
    tmp127 = tl.load(in_ptr0 + (tmp62 + 4 * tmp120 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp128 = tmp127 * tmp71
    tmp129 = tmp111 + tmp113
    tmp130 = tmp129 + tmp115
    tmp131 = tmp130 + tmp117
    tmp132 = tmp2 - tmp88
    tmp133 = tmp132 * tmp40
    tmp134 = tmp133 - tmp42
    tmp135 = tmp134 * tmp132
    tmp136 = tmp135 * tmp132
    tmp137 = tmp136 + tmp2
    tmp138 = tmp131 * tmp137
    tmp139 = tmp106 + tmp138
    tmp140 = tmp122 + tmp124
    tmp141 = tmp140 + tmp126
    tmp142 = tmp141 + tmp128
    tmp143 = tmp64 - tmp88
    tmp144 = tmp143 * tmp26
    tmp145 = tmp144 - tmp28
    tmp146 = tmp145 * tmp143
    tmp147 = tmp146 + tmp31
    tmp148 = tmp147 * tmp143
    tmp149 = tmp148 - tmp34
    tmp150 = tmp142 * tmp149
    tmp151 = tmp139 + tmp150
    tl.store(in_out_ptr1 + x4, tmp151, xmask)


def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf10 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf17 = buf10
        del buf10
        get_raw_stream(0)
        triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_floor_mul_rsub_sub_0[
            grid(256)](buf17, arg0_1, 256, XBLOCK=128, num_warps=4,
            num_stages=1)
        del arg0_1
    return buf17,


class UpsampleNew(nn.Module):

    def __init__(self, scale):
        super(UpsampleNew, self).__init__()
        self.up = nn.Upsample(scale_factor=scale, mode='bicubic',
            align_corners=True)

    def forward(self, input_0):
        arg0_1 = input_0
        output = call([arg0_1])
        return output[0]


Measured latency_ms: 0.014167