# 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/64/c64wcolc5y2n37sxtnpnhr2dzw4gq7giy4xyi4ub5z3kplhqckpr.py
# Topologically Sorted Source Nodes: [fill_], Original ATen: [aten.fill]
# Source node to ATen node mapping:
#   fill_ => full_default
# Graph fragment:
#   %full_default : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([1, 4, 4], 1), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %select_scatter_default_2 : [num_users=1] = call_function[target=torch.ops.aten.select_scatter.default](args = (%select_scatter_default_1, %full_default, 3, 2), kwargs = {})
triton_poi_fused_fill_0 = async_compile.triton('triton_poi_fused_fill_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=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_fill_0', 'mutated_arg_names': [], '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_fill_0(out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 48
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 3
    x2 = (xindex // 12)
    x1 = (xindex // 3) % 4
    x4 = xindex
    tmp0 = x0
    tmp1 = tl.full([1], 2, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = tl.full([1], 1, tl.int32)
    tmp4 = tmp0 == tmp3
    tmp5 = x2
    tmp6 = tmp5.to(tl.float32)
    tmp7 = 2.0
    tmp8 = tmp6 < tmp7
    tmp9 = 1.0
    tmp10 = tmp6 * tmp9
    tmp11 = -1.5
    tmp12 = tmp10 + tmp11
    tmp13 = 3 + ((-1)*x2)
    tmp14 = tmp13.to(tl.float32)
    tmp15 = tmp14 * tmp9
    tmp16 = 1.5
    tmp17 = tmp16 - tmp15
    tmp18 = tl.where(tmp8, tmp12, tmp17)
    tmp19 = tl.full([1], 0, tl.int32)
    tmp20 = tmp0 == tmp19
    tmp21 = x1
    tmp22 = tmp21.to(tl.float32)
    tmp23 = tmp22 < tmp7
    tmp24 = tmp22 * tmp9
    tmp25 = tmp24 + tmp11
    tmp26 = 3 + ((-1)*x1)
    tmp27 = tmp26.to(tl.float32)
    tmp28 = tmp27 * tmp9
    tmp29 = tmp16 - tmp28
    tmp30 = tl.where(tmp23, tmp25, tmp29)
    tmp31 = float("nan")
    tmp32 = tl.where(tmp20, tmp30, tmp31)
    tmp33 = tl.where(tmp4, tmp18, tmp32)
    tmp34 = tl.where(tmp2, tmp9, tmp33)
    tl.store(out_ptr0 + (x4), tmp34, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/se/cseku5skh5hydixwsucoob25sv4ybjibfc7mxegblt23gh7szjzr.py
# Topologically Sorted Source Nodes: [tensor_1, rescaled_theta], Original ATen: [aten.lift_fresh, aten.div]
# Source node to ATen node mapping:
#   rescaled_theta => div
#   tensor_1 => lift_fresh_copy_1
# Graph fragment:
#   %lift_fresh_copy_1 : [num_users=1] = call_function[target=torch.ops.aten.lift_fresh_copy.default](args = (%_tensor_constant1,), kwargs = {})
#   %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%permute, %lift_fresh_copy_1), kwargs = {})
triton_poi_fused_div_lift_fresh_1 = async_compile.triton('triton_poi_fused_div_lift_fresh_1', '''
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=[8], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '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,), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_div_lift_fresh_1', 'mutated_arg_names': [], '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_div_lift_fresh_1(out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 6
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 2
    x1 = (xindex // 2)
    x2 = xindex
    tmp0 = x1 + (3*x0)
    tmp1 = tl.full([1], 3, tl.int64)
    tmp2 = tmp0 < tmp1
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.full([1], 2, tl.int64)
    tmp6 = tmp0 < tmp5
    tmp7 = -0.06975647062063217
    tmp8 = 0.0
    tmp9 = tl.where(tmp6, tmp7, tmp8)
    tmp10 = 0.9975640773773193
    tmp11 = tl.where(tmp4, tmp10, tmp9)
    tmp12 = tl.full([1], 4, tl.int64)
    tmp13 = tmp0 < tmp12
    tmp14 = tl.full([1], 5, tl.int64)
    tmp15 = tmp0 < tmp14
    tmp16 = tl.where(tmp15, tmp10, tmp8)
    tmp17 = 0.06975647062063217
    tmp18 = tl.where(tmp13, tmp17, tmp16)
    tmp19 = tl.where(tmp2, tmp11, tmp18)
    tmp20 = x0
    tmp21 = tmp20 < tmp3
    tmp22 = 2.0
    tmp23 = tl.where(tmp21, tmp22, tmp22)
    tmp24 = tmp19 / tmp23
    tl.store(out_ptr0 + (x2), tmp24, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/zf/czfnj57ejqlqojplqt6piz7sosofcvzqdxhskwatgn32njr7acz7.py
# Topologically Sorted Source Nodes: [img], Original ATen: [aten.grid_sampler_2d]
# Source node to ATen node mapping:
#   img => add_2, add_3, full_default_3, full_default_4, ge, ge_1, index, logical_and, logical_and_1, logical_and_2, lt_2, lt_3, mul_4, mul_5, mul_6, round_1, round_2, where_4
# Graph fragment:
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_8, 2.0), kwargs = {})
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_4, 1.5), kwargs = {})
#   %round_1 : [num_users=3] = call_function[target=torch.ops.aten.round.default](args = (%add_2,), kwargs = {})
#   %ge : [num_users=1] = call_function[target=torch.ops.aten.ge.Scalar](args = (%round_1, 0), kwargs = {})
#   %lt_2 : [num_users=1] = call_function[target=torch.ops.aten.lt.Scalar](args = (%round_1, 4), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_9, 2.0), kwargs = {})
#   %add_3 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_5, 1.5), kwargs = {})
#   %round_2 : [num_users=3] = call_function[target=torch.ops.aten.round.default](args = (%add_3,), kwargs = {})
#   %ge_1 : [num_users=1] = call_function[target=torch.ops.aten.ge.Scalar](args = (%round_2, 0), kwargs = {})
#   %lt_3 : [num_users=1] = call_function[target=torch.ops.aten.lt.Scalar](args = (%round_2, 4), kwargs = {})
#   %logical_and : [num_users=1] = call_function[target=torch.ops.aten.logical_and.default](args = (%ge_1, %lt_3), kwargs = {})
#   %logical_and_1 : [num_users=1] = call_function[target=torch.ops.aten.logical_and.default](args = (%lt_2, %logical_and), kwargs = {})
#   %logical_and_2 : [num_users=3] = call_function[target=torch.ops.aten.logical_and.default](args = (%ge, %logical_and_1), kwargs = {})
#   %index : [num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%arg0_1, [%view_5, %view_6, %where_3, %where_2]), kwargs = {})
#   %full_default_4 : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([], 1), kwargs = {dtype: torch.int64, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %full_default_3 : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([], 0), kwargs = {dtype: torch.int64, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %where_4 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%logical_and_2, %full_default_4, %full_default_3), kwargs = {})
#   %mul_6 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%index, %where_4), kwargs = {})
triton_poi_fused_grid_sampler_2d_2 = async_compile.triton('triton_poi_fused_grid_sampler_2d_2', '''
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: '*fp32', 3: '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, 3), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_grid_sampler_2d_2', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 2, '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_grid_sampler_2d_2(in_ptr0, in_ptr1, 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 % 16
    x3 = (xindex // 16)
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + (2*x0), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr0 + (1 + (2*x0)), xmask, eviction_policy='evict_last')
    tmp1 = 2.0
    tmp2 = tmp0 * tmp1
    tmp3 = 1.5
    tmp4 = tmp2 + tmp3
    tmp5 = libdevice.nearbyint(tmp4)
    tmp6 = 0.0
    tmp7 = tmp5 >= tmp6
    tmp8 = 4.0
    tmp9 = tmp5 < tmp8
    tmp11 = tmp10 * tmp1
    tmp12 = tmp11 + tmp3
    tmp13 = libdevice.nearbyint(tmp12)
    tmp14 = tmp13 >= tmp6
    tmp15 = tmp13 < tmp8
    tmp16 = tmp14 & tmp15
    tmp17 = tmp9 & tmp16
    tmp18 = tmp7 & tmp17
    tmp19 = tmp13.to(tl.int64)
    tmp20 = tl.full([1], 0, tl.int64)
    tmp21 = tl.where(tmp18, tmp19, tmp20)
    tmp22 = tl.full([XBLOCK], 4, tl.int32)
    tmp23 = tmp21 + tmp22
    tmp24 = tmp21 < 0
    tmp25 = tl.where(tmp24, tmp23, tmp21)
    tl.device_assert(((0 <= tmp25) & (tmp25 < 4)) | ~(xmask), "index out of bounds: 0 <= tmp25 < 4")
    tmp27 = tmp5.to(tl.int64)
    tmp28 = tl.where(tmp18, tmp27, tmp20)
    tmp29 = tmp28 + tmp22
    tmp30 = tmp28 < 0
    tmp31 = tl.where(tmp30, tmp29, tmp28)
    tl.device_assert(((0 <= tmp31) & (tmp31 < 4)) | ~(xmask), "index out of bounds: 0 <= tmp31 < 4")
    tmp33 = tl.load(in_ptr1 + (tmp31 + (4*tmp25) + (16*x3)), xmask, eviction_policy='evict_last')
    tmp34 = tl.full([1], 1, tl.int64)
    tmp35 = tl.where(tmp18, tmp34, tmp20)
    tmp36 = tmp35.to(tl.float32)
    tmp37 = tmp33 * tmp36
    tl.store(out_ptr0 + (x4), tmp37, 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)
        buf2 = empty_strided_cuda((1, 4, 4, 3), (48, 12, 3, 1), torch.float32)
        # Topologically Sorted Source Nodes: [fill_], Original ATen: [aten.fill]
        stream0 = get_raw_stream(0)
        triton_poi_fused_fill_0.run(buf2, 48, grid=grid(48), stream=stream0)
        buf3 = empty_strided_cuda((1, 3, 2), (6, 2, 1), torch.float32)
        # Topologically Sorted Source Nodes: [tensor_1, rescaled_theta], Original ATen: [aten.lift_fresh, aten.div]
        triton_poi_fused_div_lift_fresh_1.run(buf3, 6, grid=grid(6), stream=stream0)
        buf4 = empty_strided_cuda((1, 16, 2), (32, 2, 1), torch.float32)
        # Topologically Sorted Source Nodes: [tensor_1, rescaled_theta, output_grid], Original ATen: [aten.lift_fresh, aten.div, aten.bmm]
        extern_kernels.bmm(reinterpret_tensor(buf2, (1, 16, 3), (48, 3, 1), 0), buf3, out=buf4)
        del buf2
        del buf3
        buf5 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [img], Original ATen: [aten.grid_sampler_2d]
        triton_poi_fused_grid_sampler_2d_2.run(buf4, arg0_1, buf5, 256, grid=grid(256), stream=stream0)
        del arg0_1
        del buf4
    return (buf5, )


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 typing import cast
from torch import nn
from torchvision.transforms import functional as F
import torch.nn.functional as F
import torchvision.transforms.functional as F
import torch.autograd


class Rotate(nn.Module):

    def __init__(self, angle: 'float') ->None:
        super().__init__()
        self.angle = angle

    def forward(self, image: 'torch.Tensor') ->torch.Tensor:
        return cast(torch.Tensor, F.rotate(image, self.angle))

    def extra_repr(self) ->str:
        return f'factor={self.angle}'


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


def get_init_inputs():
    return [[], {'angle': 4}]

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.triton_helpers import libdevice
from torch import nn
import torch.autograd
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_fill_0(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 48
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 3
    x2 = xindex // 12
    x1 = xindex // 3 % 4
    x4 = xindex
    tmp0 = x0
    tmp1 = tl.full([1], 2, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = tl.full([1], 1, tl.int32)
    tmp4 = tmp0 == tmp3
    tmp5 = x2
    tmp6 = tmp5.to(tl.float32)
    tmp7 = 2.0
    tmp8 = tmp6 < tmp7
    tmp9 = 1.0
    tmp10 = tmp6 * tmp9
    tmp11 = -1.5
    tmp12 = tmp10 + tmp11
    tmp13 = 3 + -1 * x2
    tmp14 = tmp13.to(tl.float32)
    tmp15 = tmp14 * tmp9
    tmp16 = 1.5
    tmp17 = tmp16 - tmp15
    tmp18 = tl.where(tmp8, tmp12, tmp17)
    tmp19 = tl.full([1], 0, tl.int32)
    tmp20 = tmp0 == tmp19
    tmp21 = x1
    tmp22 = tmp21.to(tl.float32)
    tmp23 = tmp22 < tmp7
    tmp24 = tmp22 * tmp9
    tmp25 = tmp24 + tmp11
    tmp26 = 3 + -1 * x1
    tmp27 = tmp26.to(tl.float32)
    tmp28 = tmp27 * tmp9
    tmp29 = tmp16 - tmp28
    tmp30 = tl.where(tmp23, tmp25, tmp29)
    tmp31 = float('nan')
    tmp32 = tl.where(tmp20, tmp30, tmp31)
    tmp33 = tl.where(tmp4, tmp18, tmp32)
    tmp34 = tl.where(tmp2, tmp9, tmp33)
    tl.store(out_ptr0 + x4, tmp34, xmask)


@triton.jit
def triton_poi_fused_div_lift_fresh_1(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 6
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 2
    x1 = xindex // 2
    x2 = xindex
    tmp0 = x1 + 3 * x0
    tmp1 = tl.full([1], 3, tl.int64)
    tmp2 = tmp0 < tmp1
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.full([1], 2, tl.int64)
    tmp6 = tmp0 < tmp5
    tmp7 = -0.06975647062063217
    tmp8 = 0.0
    tmp9 = tl.where(tmp6, tmp7, tmp8)
    tmp10 = 0.9975640773773193
    tmp11 = tl.where(tmp4, tmp10, tmp9)
    tmp12 = tl.full([1], 4, tl.int64)
    tmp13 = tmp0 < tmp12
    tmp14 = tl.full([1], 5, tl.int64)
    tmp15 = tmp0 < tmp14
    tmp16 = tl.where(tmp15, tmp10, tmp8)
    tmp17 = 0.06975647062063217
    tmp18 = tl.where(tmp13, tmp17, tmp16)
    tmp19 = tl.where(tmp2, tmp11, tmp18)
    tmp20 = x0
    tmp21 = tmp20 < tmp3
    tmp22 = 2.0
    tmp23 = tl.where(tmp21, tmp22, tmp22)
    tmp24 = tmp19 / tmp23
    tl.store(out_ptr0 + x2, tmp24, xmask)


@triton.jit
def triton_poi_fused_grid_sampler_2d_2(in_ptr0, in_ptr1, 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 % 16
    x3 = xindex // 16
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + 2 * x0, xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr0 + (1 + 2 * x0), xmask, eviction_policy='evict_last'
        )
    tmp1 = 2.0
    tmp2 = tmp0 * tmp1
    tmp3 = 1.5
    tmp4 = tmp2 + tmp3
    tmp5 = libdevice.nearbyint(tmp4)
    tmp6 = 0.0
    tmp7 = tmp5 >= tmp6
    tmp8 = 4.0
    tmp9 = tmp5 < tmp8
    tmp11 = tmp10 * tmp1
    tmp12 = tmp11 + tmp3
    tmp13 = libdevice.nearbyint(tmp12)
    tmp14 = tmp13 >= tmp6
    tmp15 = tmp13 < tmp8
    tmp16 = tmp14 & tmp15
    tmp17 = tmp9 & tmp16
    tmp18 = tmp7 & tmp17
    tmp19 = tmp13.to(tl.int64)
    tmp20 = tl.full([1], 0, tl.int64)
    tmp21 = tl.where(tmp18, tmp19, tmp20)
    tmp22 = tl.full([XBLOCK], 4, tl.int32)
    tmp23 = tmp21 + tmp22
    tmp24 = tmp21 < 0
    tmp25 = tl.where(tmp24, tmp23, tmp21)
    tl.device_assert((0 <= tmp25) & (tmp25 < 4) | ~xmask,
        'index out of bounds: 0 <= tmp25 < 4')
    tmp27 = tmp5.to(tl.int64)
    tmp28 = tl.where(tmp18, tmp27, tmp20)
    tmp29 = tmp28 + tmp22
    tmp30 = tmp28 < 0
    tmp31 = tl.where(tmp30, tmp29, tmp28)
    tl.device_assert((0 <= tmp31) & (tmp31 < 4) | ~xmask,
        'index out of bounds: 0 <= tmp31 < 4')
    tmp33 = tl.load(in_ptr1 + (tmp31 + 4 * tmp25 + 16 * x3), xmask,
        eviction_policy='evict_last')
    tmp34 = tl.full([1], 1, tl.int64)
    tmp35 = tl.where(tmp18, tmp34, tmp20)
    tmp36 = tmp35.to(tl.float32)
    tmp37 = tmp33 * tmp36
    tl.store(out_ptr0 + x4, tmp37, 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)
        buf2 = empty_strided_cuda((1, 4, 4, 3), (48, 12, 3, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_fill_0[grid(48)](buf2, 48, XBLOCK=64, num_warps=1,
            num_stages=1)
        buf3 = empty_strided_cuda((1, 3, 2), (6, 2, 1), torch.float32)
        triton_poi_fused_div_lift_fresh_1[grid(6)](buf3, 6, XBLOCK=8,
            num_warps=1, num_stages=1)
        buf4 = empty_strided_cuda((1, 16, 2), (32, 2, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf2, (1, 16, 3), (48, 3, 1),
            0), buf3, out=buf4)
        del buf2
        del buf3
        buf5 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_grid_sampler_2d_2[grid(256)](buf4, arg0_1, buf5, 
            256, XBLOCK=256, num_warps=4, num_stages=1)
        del arg0_1
        del buf4
    return buf5,


class RotateNew(nn.Module):

    def __init__(self, angle: 'float') ->None:
        super().__init__()
        self.angle = angle

    def extra_repr(self) ->str:
        return f'factor={self.angle}'

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