# AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _align as align
from torch import device, empty_strided
from torch._inductor.async_compile import AsyncCompile
from torch._inductor.select_algorithm import extern_kernels
from torch._inductor.codegen.multi_kernel import MultiKernelCall
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph
from torch._C import _cuda_getCurrentRawStream as get_raw_stream

aten = torch.ops.aten
inductor_ops = torch.ops.inductor
_quantized = torch.ops._quantized
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
alloc_from_pool = torch.ops.inductor._alloc_from_pool
async_compile = AsyncCompile()


# kernel path: runs/run_shard_4/inductor_cache/yu/cyumhrxnw3es3qen6qbgqg7arzzipbge5qfdw6h4pgo2pm4mgsbc.py
# Topologically Sorted Source Nodes: [bicubic_output], Original ATen: [aten.floor, aten.arange, aten._to_copy, aten.add, aten.mul, aten.sub, aten._unsafe_index, aten.clamp, aten.rsub]
# Source node to ATen node mapping:
#   bicubic_output => _unsafe_index, _unsafe_index_1, _unsafe_index_10, _unsafe_index_11, _unsafe_index_12, _unsafe_index_13, _unsafe_index_14, _unsafe_index_15, _unsafe_index_2, _unsafe_index_3, _unsafe_index_4, _unsafe_index_5, _unsafe_index_6, _unsafe_index_7, _unsafe_index_8, _unsafe_index_9, add, add_10, add_11, add_12, add_13, add_14, add_15, add_16, add_17, add_18, add_19, add_20, add_21, add_22, add_23, add_24, add_25, add_26, add_27, add_28, add_29, add_30, add_6, add_7, add_8, add_9, clamp_max, clamp_max_1, clamp_min, clamp_min_1, convert_element_type_1, floor, floor_1, iota_1, mul, mul_10, mul_11, mul_12, mul_13, mul_14, mul_15, mul_16, mul_17, mul_18, mul_19, mul_2, mul_20, mul_21, mul_22, mul_23, mul_24, mul_25, mul_26, mul_27, mul_28, mul_29, mul_3, mul_30, mul_31, mul_32, mul_33, mul_34, mul_35, mul_36, mul_37, mul_38, mul_39, mul_4, mul_40, mul_41, mul_42, mul_43, mul_44, mul_45, mul_5, mul_6, mul_7, mul_8, mul_9, sub, sub_10, sub_11, sub_12, sub_13, sub_14, sub_15, sub_16, sub_17, sub_18, sub_19, sub_2, sub_20, sub_21, sub_3, sub_6, sub_7, sub_8, sub_9
# Graph fragment:
#   %floor_1 : [num_users=2] = call_function[target=torch.ops.aten.floor.default](args = (%unsqueeze,), kwargs = {})
#   %iota_1 : [num_users=1] = call_function[target=torch.ops.prims.iota.default](args = (8,), kwargs = {start: 0, step: 1, dtype: torch.int64, device: cuda:0, requires_grad: False})
#   %convert_element_type_1 : [num_users=1] = call_function[target=torch.ops.prims.convert_element_type.default](args = (%iota_1, torch.float32), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%convert_element_type_1, 0.5), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add, 0.5), kwargs = {})
#   %sub : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul, 0.5), kwargs = {})
#   %floor : [num_users=2] = call_function[target=torch.ops.aten.floor.default](args = (%sub,), kwargs = {})
#   %_unsafe_index : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_2, %clamp_max_3]), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sub, %floor), kwargs = {})
#   %clamp_min_1 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_3, 0.0), kwargs = {})
#   %clamp_max_1 : [num_users=6] = call_function[target=torch.ops.aten.clamp_max.default](args = (%clamp_min_1, 1.0), kwargs = {})
#   %add_6 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%clamp_max_1, 1.0), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_6, -0.75), kwargs = {})
#   %sub_6 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_2, -3.75), kwargs = {})
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_6, %add_6), kwargs = {})
#   %add_7 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_3, -6.0), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_7, %add_6), kwargs = {})
#   %sub_7 : [num_users=4] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_4, -3.0), kwargs = {})
#   %mul_26 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index, %sub_7), kwargs = {})
#   %_unsafe_index_1 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_4, %clamp_max_5]), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%clamp_max_1, 1.25), kwargs = {})
#   %sub_8 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_5, 2.25), kwargs = {})
#   %mul_6 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_8, %clamp_max_1), kwargs = {})
#   %mul_7 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_6, %clamp_max_1), kwargs = {})
#   %add_8 : [num_users=4] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_7, 1), kwargs = {})
#   %mul_27 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_1, %add_8), kwargs = {})
#   %add_16 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_26, %mul_27), kwargs = {})
#   %_unsafe_index_2 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_6, %clamp_max_7]), kwargs = {})
#   %sub_9 : [num_users=3] = call_function[target=torch.ops.aten.sub.Tensor](args = (1.0, %clamp_max_1), kwargs = {})
#   %mul_8 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_9, 1.25), kwargs = {})
#   %sub_10 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_8, 2.25), kwargs = {})
#   %mul_9 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_10, %sub_9), kwargs = {})
#   %mul_10 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_9, %sub_9), kwargs = {})
#   %add_9 : [num_users=4] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_10, 1), kwargs = {})
#   %mul_28 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_2, %add_9), kwargs = {})
#   %add_17 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_16, %mul_28), kwargs = {})
#   %_unsafe_index_3 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_8, %clamp_max_9]), kwargs = {})
#   %sub_11 : [num_users=3] = call_function[target=torch.ops.aten.sub.Tensor](args = (2.0, %clamp_max_1), kwargs = {})
#   %mul_11 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_11, -0.75), kwargs = {})
#   %sub_12 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_11, -3.75), kwargs = {})
#   %mul_12 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_12, %sub_11), kwargs = {})
#   %add_10 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_12, -6.0), kwargs = {})
#   %mul_13 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_10, %sub_11), kwargs = {})
#   %sub_13 : [num_users=4] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_13, -3.0), kwargs = {})
#   %mul_29 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_3, %sub_13), kwargs = {})
#   %add_18 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_17, %mul_29), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%unsqueeze, %floor_1), kwargs = {})
#   %clamp_min : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_2, 0.0), kwargs = {})
#   %clamp_max : [num_users=6] = call_function[target=torch.ops.aten.clamp_max.default](args = (%clamp_min, 1.0), kwargs = {})
#   %add_11 : [num_users=3] = call_function[target=torch.ops.aten.add.Tensor](args = (%clamp_max, 1.0), kwargs = {})
#   %mul_14 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_11, -0.75), kwargs = {})
#   %sub_14 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_14, -3.75), kwargs = {})
#   %mul_15 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_14, %add_11), kwargs = {})
#   %add_12 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_15, -6.0), kwargs = {})
#   %mul_16 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_12, %add_11), kwargs = {})
#   %sub_15 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_16, -3.0), kwargs = {})
#   %mul_42 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_18, %sub_15), kwargs = {})
#   %_unsafe_index_4 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_10, %clamp_max_11]), kwargs = {})
#   %mul_30 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_4, %sub_7), kwargs = {})
#   %_unsafe_index_5 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_12, %clamp_max_13]), kwargs = {})
#   %mul_31 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_5, %add_8), kwargs = {})
#   %add_19 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_30, %mul_31), kwargs = {})
#   %_unsafe_index_6 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_14, %clamp_max_15]), kwargs = {})
#   %mul_32 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_6, %add_9), kwargs = {})
#   %add_20 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_19, %mul_32), kwargs = {})
#   %_unsafe_index_7 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_16, %clamp_max_17]), kwargs = {})
#   %mul_33 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_7, %sub_13), kwargs = {})
#   %add_21 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_20, %mul_33), kwargs = {})
#   %mul_17 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%clamp_max, 1.25), kwargs = {})
#   %sub_16 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_17, 2.25), kwargs = {})
#   %mul_18 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_16, %clamp_max), kwargs = {})
#   %mul_19 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_18, %clamp_max), kwargs = {})
#   %add_13 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_19, 1), kwargs = {})
#   %mul_43 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_21, %add_13), kwargs = {})
#   %add_28 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_42, %mul_43), kwargs = {})
#   %_unsafe_index_8 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_18, %clamp_max_19]), kwargs = {})
#   %mul_34 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_8, %sub_7), kwargs = {})
#   %_unsafe_index_9 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_20, %clamp_max_21]), kwargs = {})
#   %mul_35 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_9, %add_8), kwargs = {})
#   %add_22 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_34, %mul_35), kwargs = {})
#   %_unsafe_index_10 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_22, %clamp_max_23]), kwargs = {})
#   %mul_36 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_10, %add_9), kwargs = {})
#   %add_23 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_22, %mul_36), kwargs = {})
#   %_unsafe_index_11 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_24, %clamp_max_25]), kwargs = {})
#   %mul_37 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_11, %sub_13), kwargs = {})
#   %add_24 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_23, %mul_37), kwargs = {})
#   %sub_17 : [num_users=3] = call_function[target=torch.ops.aten.sub.Tensor](args = (1.0, %clamp_max), kwargs = {})
#   %mul_20 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_17, 1.25), kwargs = {})
#   %sub_18 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_20, 2.25), kwargs = {})
#   %mul_21 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_18, %sub_17), kwargs = {})
#   %mul_22 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_21, %sub_17), kwargs = {})
#   %add_14 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_22, 1), kwargs = {})
#   %mul_44 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_24, %add_14), kwargs = {})
#   %add_29 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_28, %mul_44), kwargs = {})
#   %_unsafe_index_12 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_26, %clamp_max_27]), kwargs = {})
#   %mul_38 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_12, %sub_7), kwargs = {})
#   %_unsafe_index_13 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_28, %clamp_max_29]), kwargs = {})
#   %mul_39 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_13, %add_8), kwargs = {})
#   %add_25 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_38, %mul_39), kwargs = {})
#   %_unsafe_index_14 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_30, %clamp_max_31]), kwargs = {})
#   %mul_40 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_14, %add_9), kwargs = {})
#   %add_26 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_25, %mul_40), kwargs = {})
#   %_unsafe_index_15 : [num_users=1] = call_function[target=torch.ops.aten._unsafe_index.Tensor](args = (%arg0_1, [None, None, %clamp_max_32, %clamp_max_33]), kwargs = {})
#   %mul_41 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%_unsafe_index_15, %sub_13), kwargs = {})
#   %add_27 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_26, %mul_41), kwargs = {})
#   %sub_19 : [num_users=3] = call_function[target=torch.ops.aten.sub.Tensor](args = (2.0, %clamp_max), kwargs = {})
#   %mul_23 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_19, -0.75), kwargs = {})
#   %sub_20 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_23, -3.75), kwargs = {})
#   %mul_24 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_20, %sub_19), kwargs = {})
#   %add_15 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_24, -6.0), kwargs = {})
#   %mul_25 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_15, %sub_19), kwargs = {})
#   %sub_21 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_25, -3.0), kwargs = {})
#   %mul_45 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_27, %sub_21), kwargs = {})
#   %add_30 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_29, %mul_45), kwargs = {})
triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_floor_mul_rsub_sub_0 = async_compile.triton('triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_floor_mul_rsub_sub_0', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[1024], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_floor_mul_rsub_sub_0', 'mutated_arg_names': ['in_out_ptr1'], 'no_x_dim': False, 'num_load': 0, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@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 = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = (xindex // 8) % 8
    x0 = xindex % 8
    x2 = (xindex // 64)
    x3 = xindex
    tmp0 = x1
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = libdevice.floor(tmp5)
    tmp7 = tmp6.to(tl.int32)
    tmp8 = tl.full([1], 1, tl.int64)
    tmp9 = tmp7 - tmp8
    tmp10 = tl.full([1], 0, tl.int64)
    tmp11 = triton_helpers.maximum(tmp9, tmp10)
    tmp12 = tl.full([1], 3, tl.int64)
    tmp13 = triton_helpers.minimum(tmp11, tmp12)
    tmp14 = x0
    tmp15 = tmp14.to(tl.float32)
    tmp16 = tmp15 + tmp2
    tmp17 = tmp16 * tmp2
    tmp18 = tmp17 - tmp2
    tmp19 = libdevice.floor(tmp18)
    tmp20 = tmp19.to(tl.int32)
    tmp21 = tmp20 - tmp8
    tmp22 = triton_helpers.maximum(tmp21, tmp10)
    tmp23 = triton_helpers.minimum(tmp22, tmp12)
    tmp24 = tl.load(in_ptr0 + (tmp23 + (4*tmp13) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp25 = tmp18 - tmp19
    tmp26 = 0.0
    tmp27 = triton_helpers.maximum(tmp25, tmp26)
    tmp28 = 1.0
    tmp29 = triton_helpers.minimum(tmp27, tmp28)
    tmp30 = tmp29 + tmp28
    tmp31 = -0.75
    tmp32 = tmp30 * tmp31
    tmp33 = -3.75
    tmp34 = tmp32 - tmp33
    tmp35 = tmp34 * tmp30
    tmp36 = -6.0
    tmp37 = tmp35 + tmp36
    tmp38 = tmp37 * tmp30
    tmp39 = -3.0
    tmp40 = tmp38 - tmp39
    tmp41 = tmp24 * tmp40
    tmp42 = triton_helpers.maximum(tmp20, tmp10)
    tmp43 = triton_helpers.minimum(tmp42, tmp12)
    tmp44 = tl.load(in_ptr0 + (tmp43 + (4*tmp13) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp45 = 1.25
    tmp46 = tmp29 * tmp45
    tmp47 = 2.25
    tmp48 = tmp46 - tmp47
    tmp49 = tmp48 * tmp29
    tmp50 = tmp49 * tmp29
    tmp51 = tmp50 + tmp28
    tmp52 = tmp44 * tmp51
    tmp53 = tmp20 + tmp8
    tmp54 = triton_helpers.maximum(tmp53, tmp10)
    tmp55 = triton_helpers.minimum(tmp54, tmp12)
    tmp56 = tl.load(in_ptr0 + (tmp55 + (4*tmp13) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp57 = tmp28 - tmp29
    tmp58 = tmp57 * tmp45
    tmp59 = tmp58 - tmp47
    tmp60 = tmp59 * tmp57
    tmp61 = tmp60 * tmp57
    tmp62 = tmp61 + tmp28
    tmp63 = tmp56 * tmp62
    tmp64 = tl.full([1], 2, tl.int64)
    tmp65 = tmp20 + tmp64
    tmp66 = triton_helpers.maximum(tmp65, tmp10)
    tmp67 = triton_helpers.minimum(tmp66, tmp12)
    tmp68 = tl.load(in_ptr0 + (tmp67 + (4*tmp13) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp69 = 2.0
    tmp70 = tmp69 - tmp29
    tmp71 = tmp70 * tmp31
    tmp72 = tmp71 - tmp33
    tmp73 = tmp72 * tmp70
    tmp74 = tmp73 + tmp36
    tmp75 = tmp74 * tmp70
    tmp76 = tmp75 - tmp39
    tmp77 = tmp68 * tmp76
    tmp78 = tmp41 + tmp52
    tmp79 = tmp78 + tmp63
    tmp80 = tmp79 + tmp77
    tmp81 = tmp5 - tmp6
    tmp82 = triton_helpers.maximum(tmp81, tmp26)
    tmp83 = triton_helpers.minimum(tmp82, tmp28)
    tmp84 = tmp83 + tmp28
    tmp85 = tmp84 * tmp31
    tmp86 = tmp85 - tmp33
    tmp87 = tmp86 * tmp84
    tmp88 = tmp87 + tmp36
    tmp89 = tmp88 * tmp84
    tmp90 = tmp89 - tmp39
    tmp91 = tmp80 * tmp90
    tmp92 = triton_helpers.maximum(tmp7, tmp10)
    tmp93 = triton_helpers.minimum(tmp92, tmp12)
    tmp94 = tl.load(in_ptr0 + (tmp23 + (4*tmp93) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp95 = tmp94 * tmp40
    tmp96 = tl.load(in_ptr0 + (tmp43 + (4*tmp93) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp97 = tmp96 * tmp51
    tmp98 = tl.load(in_ptr0 + (tmp55 + (4*tmp93) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp99 = tmp98 * tmp62
    tmp100 = tl.load(in_ptr0 + (tmp67 + (4*tmp93) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp101 = tmp100 * tmp76
    tmp102 = tmp7 + tmp8
    tmp103 = triton_helpers.maximum(tmp102, tmp10)
    tmp104 = triton_helpers.minimum(tmp103, tmp12)
    tmp105 = tl.load(in_ptr0 + (tmp23 + (4*tmp104) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp106 = tmp105 * tmp40
    tmp107 = tl.load(in_ptr0 + (tmp43 + (4*tmp104) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp108 = tmp107 * tmp51
    tmp109 = tl.load(in_ptr0 + (tmp55 + (4*tmp104) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp110 = tmp109 * tmp62
    tmp111 = tl.load(in_ptr0 + (tmp67 + (4*tmp104) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp112 = tmp111 * tmp76
    tmp113 = tmp95 + tmp97
    tmp114 = tmp113 + tmp99
    tmp115 = tmp114 + tmp101
    tmp116 = tmp83 * tmp45
    tmp117 = tmp116 - tmp47
    tmp118 = tmp117 * tmp83
    tmp119 = tmp118 * tmp83
    tmp120 = tmp119 + tmp28
    tmp121 = tmp115 * tmp120
    tmp122 = tmp91 + tmp121
    tmp123 = tmp106 + tmp108
    tmp124 = tmp123 + tmp110
    tmp125 = tmp124 + tmp112
    tmp126 = tmp28 - tmp83
    tmp127 = tmp126 * tmp45
    tmp128 = tmp127 - tmp47
    tmp129 = tmp128 * tmp126
    tmp130 = tmp129 * tmp126
    tmp131 = tmp130 + tmp28
    tmp132 = tmp125 * tmp131
    tmp133 = tmp122 + tmp132
    tmp134 = tmp7 + tmp64
    tmp135 = triton_helpers.maximum(tmp134, tmp10)
    tmp136 = triton_helpers.minimum(tmp135, tmp12)
    tmp137 = tl.load(in_ptr0 + (tmp23 + (4*tmp136) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp138 = tmp137 * tmp40
    tmp139 = tl.load(in_ptr0 + (tmp43 + (4*tmp136) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp140 = tmp139 * tmp51
    tmp141 = tl.load(in_ptr0 + (tmp55 + (4*tmp136) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp142 = tmp141 * tmp62
    tmp143 = tl.load(in_ptr0 + (tmp67 + (4*tmp136) + (16*x2)), xmask, eviction_policy='evict_last')
    tmp144 = tmp143 * tmp76
    tmp145 = tmp138 + tmp140
    tmp146 = tmp145 + tmp142
    tmp147 = tmp146 + tmp144
    tmp148 = tmp69 - tmp83
    tmp149 = tmp148 * tmp31
    tmp150 = tmp149 - tmp33
    tmp151 = tmp150 * tmp148
    tmp152 = tmp151 + tmp36
    tmp153 = tmp152 * tmp148
    tmp154 = tmp153 - tmp39
    tmp155 = tmp147 * tmp154
    tmp156 = tmp133 + tmp155
    tl.store(in_out_ptr1 + (x3), tmp156, xmask)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

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, 8, 8), (256, 64, 8, 1), torch.float32)
        buf13 = buf10; del buf10  # reuse
        buf19 = buf13; del buf13  # reuse
        # Topologically Sorted Source Nodes: [bicubic_output], Original ATen: [aten.floor, aten.arange, aten._to_copy, aten.add, aten.mul, aten.sub, aten._unsafe_index, aten.clamp, aten.rsub]
        stream0 = get_raw_stream(0)
        triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_floor_mul_rsub_sub_0.run(buf19, arg0_1, 1024, grid=grid(1024), stream=stream0)
        del arg0_1
    return (buf19, )


def benchmark_compiled_module(times=10, repeat=10):
    from torch._dynamo.testing import rand_strided
    from torch._inductor.utils import print_performance
    arg0_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([arg0_1])
    return print_performance(fn, times=times, repeat=repeat)


if __name__ == "__main__":
    from torch._inductor.wrapper_benchmark import compiled_module_main
    compiled_module_main('None', benchmark_compiled_module)

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


class Bicubic(nn.Module):

    def __init__(self, scale_factor=2):
        super().__init__()
        self.scale_factor = scale_factor

    def forward(self, inputs):
        bicubic_output = F.interpolate(inputs, scale_factor=self.
            scale_factor, mode='bicubic')
        return bicubic_output


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


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

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
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


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


class BicubicNew(nn.Module):

    def __init__(self, scale_factor=2):
        super().__init__()
        self.scale_factor = scale_factor

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