# 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_6/inductor_cache/vh/cvhnjifpbeg74dy6aidw57hgdfupjminabxhl3ft73hjajihyerq.py
# Topologically Sorted Source Nodes: [interpolate], Original ATen: [aten.floor, aten.arange, aten._to_copy, aten.mul, aten._unsafe_index, aten.sub, aten.clamp, aten.add, aten.rsub]
# Source node to ATen node mapping:
#   interpolate => _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_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_4, add_5, 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_1, sub_10, sub_11, sub_12, sub_13, sub_14, sub_15, sub_16, sub_17, sub_18, sub_19, sub_4, sub_5, 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 = (4,), 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 = {})
#   %mul : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%convert_element_type_1, 1.0), kwargs = {})
#   %floor : [num_users=2] = call_function[target=torch.ops.aten.floor.default](args = (%mul,), 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_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul, %floor), kwargs = {})
#   %clamp_min_1 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_1, 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_4 : [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_4, -0.75), kwargs = {})
#   %sub_4 : [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_4, %add_4), kwargs = {})
#   %add_5 : [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_5, %add_4), kwargs = {})
#   %sub_5 : [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_5), 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_6 : [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_6, %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_6 : [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_6), kwargs = {})
#   %add_14 : [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_7 : [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_7, 1.25), kwargs = {})
#   %sub_8 : [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_8, %sub_7), kwargs = {})
#   %mul_10 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_9, %sub_7), kwargs = {})
#   %add_7 : [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_7), kwargs = {})
#   %add_15 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_14, %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_9 : [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_9, -0.75), kwargs = {})
#   %sub_10 : [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_10, %sub_9), kwargs = {})
#   %add_8 : [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_8, %sub_9), kwargs = {})
#   %sub_11 : [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_11), kwargs = {})
#   %add_16 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_15, %mul_29), kwargs = {})
#   %sub : [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, 0.0), kwargs = {})
#   %clamp_max : [num_users=6] = call_function[target=torch.ops.aten.clamp_max.default](args = (%clamp_min, 1.0), kwargs = {})
#   %add_9 : [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_9, -0.75), kwargs = {})
#   %sub_12 : [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_12, %add_9), kwargs = {})
#   %add_10 : [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_10, %add_9), kwargs = {})
#   %sub_13 : [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_16, %sub_13), 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_5), 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_6), kwargs = {})
#   %add_17 : [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_7), kwargs = {})
#   %add_18 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_17, %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_11), kwargs = {})
#   %add_19 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_18, %mul_33), kwargs = {})
#   %mul_17 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%clamp_max, 1.25), kwargs = {})
#   %sub_14 : [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_14, %clamp_max), kwargs = {})
#   %mul_19 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_18, %clamp_max), kwargs = {})
#   %add_11 : [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_19, %add_11), kwargs = {})
#   %add_26 : [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_5), 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_6), kwargs = {})
#   %add_20 : [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_7), kwargs = {})
#   %add_21 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_20, %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_11), kwargs = {})
#   %add_22 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_21, %mul_37), kwargs = {})
#   %sub_15 : [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_15, 1.25), kwargs = {})
#   %sub_16 : [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_16, %sub_15), kwargs = {})
#   %mul_22 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_21, %sub_15), kwargs = {})
#   %add_12 : [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_22, %add_12), kwargs = {})
#   %add_27 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_26, %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_5), 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_6), kwargs = {})
#   %add_23 : [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_7), kwargs = {})
#   %add_24 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_23, %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_11), kwargs = {})
#   %add_25 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_24, %mul_41), kwargs = {})
#   %sub_17 : [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_17, -0.75), kwargs = {})
#   %sub_18 : [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_18, %sub_17), kwargs = {})
#   %add_13 : [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_13, %sub_17), kwargs = {})
#   %sub_19 : [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_25, %sub_19), kwargs = {})
#   %add_28 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_27, %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=[256], 
    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 = 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)
''', 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, 4, 4), (64, 16, 4, 1), torch.float32)
        buf17 = buf10; del buf10  # reuse
        # Topologically Sorted Source Nodes: [interpolate], Original ATen: [aten.floor, aten.arange, aten._to_copy, aten.mul, aten._unsafe_index, aten.sub, aten.clamp, aten.add, aten.rsub]
        stream0 = get_raw_stream(0)
        triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_floor_mul_rsub_sub_0.run(buf17, arg0_1, 256, grid=grid(256), stream=stream0)
        del arg0_1
    return (buf17, )


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
from torch import nn
import torch.utils.data
import torch


class Upsample(nn.Module):

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

    def forward(self, x):
        return self.up(x)


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


def get_init_inputs():
    return [[], {'scale': 1.0}]

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]
