# 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/7k/c7kwcfcuvlusmnxjznncamkapi5fn6ei5hugqjy6mymrjfmh7jkq.py
# Topologically Sorted Source Nodes: [mul], Original ATen: [aten.mul]
# Source node to ATen node mapping:
#   mul => mul
# Graph fragment:
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%permute, -1.0), kwargs = {})
triton_poi_fused_mul_0 = async_compile.triton('triton_poi_fused_mul_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: '*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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, '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_mul_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 36
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 3
    x1 = (xindex // 3) % 3
    x2 = (xindex // 9)
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + (4*x1) + (16*x2)), xmask)
    tmp1 = -1.0
    tmp2 = tmp0 * tmp1
    tl.store(out_ptr0 + (x3), tmp2, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/2v/c2v5qbzq6y7mlijzpjbwl6jmt6sqsabsp6c5xd65ma5ymhh54bhs.py
# Topologically Sorted Source Nodes: [new_zeros, pose_inv, setitem, setitem_1, setitem_2], Original ATen: [aten.new_zeros, aten.add, aten.copy, aten.lift_fresh, aten.fill]
# Source node to ATen node mapping:
#   new_zeros => full
#   pose_inv => add
#   setitem => copy
#   setitem_1 => copy_1
#   setitem_2 => copy_2, full_default
# Graph fragment:
#   %full : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([4, 4, 4], 0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %add : [num_users=4] = call_function[target=torch.ops.aten.add.Tensor](args = (%full, 1e-06), kwargs = {})
#   %copy : [num_users=1] = call_function[target=torch.ops.aten.copy.default](args = (%slice_6, %permute), kwargs = {})
#   %slice_scatter_default : [num_users=1] = call_function[target=torch.ops.aten.slice_scatter.default](args = (%slice_tensor, %copy, 2, 0, 3), kwargs = {})
#   %slice_scatter_default_1 : [num_users=4] = call_function[target=torch.ops.aten.slice_scatter.default](args = (%add, %slice_scatter_default, 1, 0, 3), kwargs = {})
#   %copy_1 : [num_users=1] = call_function[target=torch.ops.aten.copy.default](args = (%slice_13, %bmm), kwargs = {})
#   %slice_scatter_default_2 : [num_users=1] = call_function[target=torch.ops.aten.slice_scatter.default](args = (%slice_tensor_1, %copy_1, 2, 3, 4), kwargs = {})
#   %slice_scatter_default_3 : [num_users=4] = call_function[target=torch.ops.aten.slice_scatter.default](args = (%slice_scatter_default_1, %slice_scatter_default_2, 1, 0, 3), kwargs = {})
#   %full_default : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([], 1.0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %copy_2 : [num_users=1] = call_function[target=torch.ops.aten.copy.default](args = (%select_3, %full_default), kwargs = {})
#   %select_scatter_default : [num_users=1] = call_function[target=torch.ops.aten.select_scatter.default](args = (%select_int, %copy_2, 1, 3), kwargs = {})
#   %select_scatter_default_1 : [num_users=1] = call_function[target=torch.ops.aten.select_scatter.default](args = (%slice_scatter_default_3, %select_scatter_default, 1, 3), kwargs = {})
triton_poi_fused_add_copy_fill_lift_fresh_new_zeros_1 = async_compile.triton('triton_poi_fused_add_copy_fill_lift_fresh_new_zeros_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=[16, 4], tile_hint=TileHint.DEFAULT,
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: 'i32', 4: '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_add_copy_fill_lift_fresh_new_zeros_1', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 6, '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_add_copy_fill_lift_fresh_new_zeros_1(in_ptr0, in_ptr1, out_ptr0, ynumel, xnumel, YBLOCK : tl.constexpr, XBLOCK : tl.constexpr):
    ynumel = 16
    xnumel = 4
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y0 = yindex % 4
    y1 = (yindex // 4)
    y3 = yindex
    tmp0 = x2
    tmp1 = tl.full([1, 1], 3, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = y0
    tmp4 = tmp3 == tmp1
    tmp5 = tl.full([1, 1], 3, tl.int64)
    tmp6 = tmp5 < tmp5
    tmp7 = tl.broadcast_to(y0, [XBLOCK, YBLOCK])
    tmp8 = tmp7 >= tmp5
    tmp9 = tmp8 & tmp6
    tmp10 = tl.load(in_ptr0 + (tl.broadcast_to(3 + (3*y1), [XBLOCK, YBLOCK])), tmp9 & xmask & ymask, eviction_policy='evict_last', other=0.0)
    tmp11 = tmp6 & tmp6
    tmp12 = tmp7 < tmp5
    tmp13 = tmp12 & tmp11
    tmp14 = tl.load(in_ptr1 + (tl.broadcast_to(3 + (4*y3), [XBLOCK, YBLOCK])), tmp13 & xmask & ymask, eviction_policy='evict_last', other=0.0)
    tmp15 = 1e-06
    tmp16 = tl.where(tmp12, tmp14, tmp15)
    tmp17 = tl.full(tmp16.shape, 0.0, tmp16.dtype)
    tmp18 = tl.where(tmp11, tmp16, tmp17)
    tmp19 = tl.where(tmp6, tmp18, tmp15)
    tmp20 = tl.where(tmp8, tmp10, tmp19)
    tmp21 = tl.full(tmp20.shape, 0.0, tmp20.dtype)
    tmp22 = tl.where(tmp6, tmp20, tmp21)
    tmp23 = tmp12 & tmp6
    tmp24 = tl.load(in_ptr1 + (tl.broadcast_to(3 + (4*y3), [XBLOCK, YBLOCK])), tmp23 & xmask & ymask, eviction_policy='evict_last', other=0.0)
    tmp25 = tl.where(tmp12, tmp24, tmp15)
    tmp26 = tl.full(tmp25.shape, 0.0, tmp25.dtype)
    tmp27 = tl.where(tmp6, tmp25, tmp26)
    tmp28 = tl.where(tmp6, tmp27, tmp15)
    tmp29 = tl.where(tmp6, tmp22, tmp28)
    tmp30 = 1.0
    tmp31 = tl.where(tmp4, tmp30, tmp29)
    tmp32 = tmp0 < tmp5
    tmp33 = tmp8 & tmp32
    tmp34 = tl.load(in_ptr0 + (x2 + (3*y1)), tmp33 & xmask & ymask, eviction_policy='evict_last', other=0.0)
    tmp35 = tl.broadcast_to(x2, [XBLOCK, YBLOCK])
    tmp36 = tmp35 < tmp5
    tmp37 = tmp36 & tmp32
    tmp38 = tmp12 & tmp37
    tmp39 = tl.load(in_ptr1 + (x2 + (4*y3)), tmp38 & xmask & ymask, eviction_policy='evict_last', other=0.0)
    tmp40 = tl.where(tmp12, tmp39, tmp15)
    tmp41 = tl.full(tmp40.shape, 0.0, tmp40.dtype)
    tmp42 = tl.where(tmp37, tmp40, tmp41)
    tmp43 = tl.where(tmp36, tmp42, tmp15)
    tmp44 = tl.where(tmp8, tmp34, tmp43)
    tmp45 = tl.full(tmp44.shape, 0.0, tmp44.dtype)
    tmp46 = tl.where(tmp32, tmp44, tmp45)
    tmp47 = tmp12 & tmp32
    tmp48 = tl.load(in_ptr1 + (x2 + (4*y3)), tmp47 & xmask & ymask, eviction_policy='evict_last', other=0.0)
    tmp49 = tl.where(tmp12, tmp48, tmp15)
    tmp50 = tl.full(tmp49.shape, 0.0, tmp49.dtype)
    tmp51 = tl.where(tmp32, tmp49, tmp50)
    tmp52 = tl.where(tmp32, tmp51, tmp15)
    tmp53 = tl.where(tmp32, tmp46, tmp52)
    tmp54 = tl.where(tmp2, tmp31, tmp53)
    tl.store(out_ptr0 + (y0 + (4*x2) + (16*y1)), tmp54, xmask & ymask)
''', 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), (16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 3, 3), (9, 1, 3), torch.float32)
        # Topologically Sorted Source Nodes: [mul], Original ATen: [aten.mul]
        stream0 = get_raw_stream(0)
        triton_poi_fused_mul_0.run(arg0_1, buf0, 36, grid=grid(36), stream=stream0)
        buf1 = empty_strided_cuda((4, 3, 1), (3, 1, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul, matmul], Original ATen: [aten.mul, aten.bmm]
        extern_kernels.bmm(buf0, reinterpret_tensor(arg0_1, (4, 3, 1), (16, 4, 1), 3), out=buf1)
        del buf0
        buf2 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [new_zeros, pose_inv, setitem, setitem_1, setitem_2], Original ATen: [aten.new_zeros, aten.add, aten.copy, aten.lift_fresh, aten.fill]
        triton_poi_fused_add_copy_fill_lift_fresh_new_zeros_1.run(buf1, arg0_1, buf2, 16, 4, grid=grid(16, 4), stream=stream0)
        del arg0_1
        del buf1
    return (buf2, )


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), (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


def inverse_pose(pose, eps=1e-06):
    """Function that inverts a 4x4 pose.

    Args:
        points (Tensor): tensor with poses.

    Returns:
        Tensor: tensor with inverted poses.

    Shape:
        - Input: :math:`(N, 4, 4)`
        - Output: :math:`(N, 4, 4)`

    Example:
        >>> pose = torch.rand(1, 4, 4)         # Nx4x4
        >>> pose_inv = tgm.inverse_pose(pose)  # Nx4x4
    """
    if not torch.is_tensor(pose):
        raise TypeError('Input type is not a torch.Tensor. Got {}'.format(
            type(pose)))
    if not len(pose.shape) == 3 and pose.shape[-2:] == (4, 4):
        raise ValueError('Input size must be a Nx4x4 tensor. Got {}'.format
            (pose.shape))
    r_mat = pose[..., :3, 0:3]
    t_vec = pose[..., :3, 3:4]
    r_mat_trans = torch.transpose(r_mat, 1, 2)
    pose_inv = pose.new_zeros(pose.shape) + eps
    pose_inv[..., :3, 0:3] = r_mat_trans
    pose_inv[..., :3, 3:4] = torch.matmul(-1.0 * r_mat_trans, t_vec)
    pose_inv[..., 3, 3] = 1.0
    return pose_inv


class InversePose(nn.Module):
    """Creates a transformation that inverts a 4x4 pose.

    Args:
        points (Tensor): tensor with poses.

    Returns:
        Tensor: tensor with inverted poses.

    Shape:
        - Input: :math:`(N, 4, 4)`
        - Output: :math:`(N, 4, 4)`

    Example:
        >>> pose = torch.rand(1, 4, 4)  # Nx4x4
        >>> transform = tgm.InversePose()
        >>> pose_inv = transform(pose)  # Nx4x4
    """

    def __init__(self):
        super(InversePose, self).__init__()

    def forward(self, input):
        return inverse_pose(input)


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


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

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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_poi_fused_mul_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 36
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 3
    x1 = xindex // 3 % 3
    x2 = xindex // 9
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 4 * x1 + 16 * x2), xmask)
    tmp1 = -1.0
    tmp2 = tmp0 * tmp1
    tl.store(out_ptr0 + x3, tmp2, xmask)


@triton.jit
def triton_poi_fused_add_copy_fill_lift_fresh_new_zeros_1(in_ptr0, in_ptr1,
    out_ptr0, ynumel, xnumel, YBLOCK: tl.constexpr, XBLOCK: tl.constexpr):
    ynumel = 16
    xnumel = 4
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y0 = yindex % 4
    y1 = yindex // 4
    y3 = yindex
    tmp0 = x2
    tmp1 = tl.full([1, 1], 3, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = y0
    tmp4 = tmp3 == tmp1
    tmp5 = tl.full([1, 1], 3, tl.int64)
    tmp6 = tmp5 < tmp5
    tmp7 = tl.broadcast_to(y0, [XBLOCK, YBLOCK])
    tmp8 = tmp7 >= tmp5
    tmp9 = tmp8 & tmp6
    tmp10 = tl.load(in_ptr0 + tl.broadcast_to(3 + 3 * y1, [XBLOCK, YBLOCK]),
        tmp9 & xmask & ymask, eviction_policy='evict_last', other=0.0)
    tmp11 = tmp6 & tmp6
    tmp12 = tmp7 < tmp5
    tmp13 = tmp12 & tmp11
    tmp14 = tl.load(in_ptr1 + tl.broadcast_to(3 + 4 * y3, [XBLOCK, YBLOCK]),
        tmp13 & xmask & ymask, eviction_policy='evict_last', other=0.0)
    tmp15 = 1e-06
    tmp16 = tl.where(tmp12, tmp14, tmp15)
    tmp17 = tl.full(tmp16.shape, 0.0, tmp16.dtype)
    tmp18 = tl.where(tmp11, tmp16, tmp17)
    tmp19 = tl.where(tmp6, tmp18, tmp15)
    tmp20 = tl.where(tmp8, tmp10, tmp19)
    tmp21 = tl.full(tmp20.shape, 0.0, tmp20.dtype)
    tmp22 = tl.where(tmp6, tmp20, tmp21)
    tmp23 = tmp12 & tmp6
    tmp24 = tl.load(in_ptr1 + tl.broadcast_to(3 + 4 * y3, [XBLOCK, YBLOCK]),
        tmp23 & xmask & ymask, eviction_policy='evict_last', other=0.0)
    tmp25 = tl.where(tmp12, tmp24, tmp15)
    tmp26 = tl.full(tmp25.shape, 0.0, tmp25.dtype)
    tmp27 = tl.where(tmp6, tmp25, tmp26)
    tmp28 = tl.where(tmp6, tmp27, tmp15)
    tmp29 = tl.where(tmp6, tmp22, tmp28)
    tmp30 = 1.0
    tmp31 = tl.where(tmp4, tmp30, tmp29)
    tmp32 = tmp0 < tmp5
    tmp33 = tmp8 & tmp32
    tmp34 = tl.load(in_ptr0 + (x2 + 3 * y1), tmp33 & xmask & ymask,
        eviction_policy='evict_last', other=0.0)
    tmp35 = tl.broadcast_to(x2, [XBLOCK, YBLOCK])
    tmp36 = tmp35 < tmp5
    tmp37 = tmp36 & tmp32
    tmp38 = tmp12 & tmp37
    tmp39 = tl.load(in_ptr1 + (x2 + 4 * y3), tmp38 & xmask & ymask,
        eviction_policy='evict_last', other=0.0)
    tmp40 = tl.where(tmp12, tmp39, tmp15)
    tmp41 = tl.full(tmp40.shape, 0.0, tmp40.dtype)
    tmp42 = tl.where(tmp37, tmp40, tmp41)
    tmp43 = tl.where(tmp36, tmp42, tmp15)
    tmp44 = tl.where(tmp8, tmp34, tmp43)
    tmp45 = tl.full(tmp44.shape, 0.0, tmp44.dtype)
    tmp46 = tl.where(tmp32, tmp44, tmp45)
    tmp47 = tmp12 & tmp32
    tmp48 = tl.load(in_ptr1 + (x2 + 4 * y3), tmp47 & xmask & ymask,
        eviction_policy='evict_last', other=0.0)
    tmp49 = tl.where(tmp12, tmp48, tmp15)
    tmp50 = tl.full(tmp49.shape, 0.0, tmp49.dtype)
    tmp51 = tl.where(tmp32, tmp49, tmp50)
    tmp52 = tl.where(tmp32, tmp51, tmp15)
    tmp53 = tl.where(tmp32, tmp46, tmp52)
    tmp54 = tl.where(tmp2, tmp31, tmp53)
    tl.store(out_ptr0 + (y0 + 4 * x2 + 16 * y1), tmp54, xmask & ymask)


def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4), (16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 3, 3), (9, 1, 3), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_mul_0[grid(36)](arg0_1, buf0, 36, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf1 = empty_strided_cuda((4, 3, 1), (3, 1, 1), torch.float32)
        extern_kernels.bmm(buf0, reinterpret_tensor(arg0_1, (4, 3, 1), (16,
            4, 1), 3), out=buf1)
        del buf0
        buf2 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        triton_poi_fused_add_copy_fill_lift_fresh_new_zeros_1[grid(16, 4)](buf1
            , arg0_1, buf2, 16, 4, XBLOCK=4, YBLOCK=8, num_warps=1,
            num_stages=1)
        del arg0_1
        del buf1
    return buf2,


def inverse_pose(pose, eps=1e-06):
    """Function that inverts a 4x4 pose.

    Args:
        points (Tensor): tensor with poses.

    Returns:
        Tensor: tensor with inverted poses.

    Shape:
        - Input: :math:`(N, 4, 4)`
        - Output: :math:`(N, 4, 4)`

    Example:
        >>> pose = torch.rand(1, 4, 4)         # Nx4x4
        >>> pose_inv = tgm.inverse_pose(pose)  # Nx4x4
    """
    if not torch.is_tensor(pose):
        raise TypeError('Input type is not a torch.Tensor. Got {}'.format(
            type(pose)))
    if not len(pose.shape) == 3 and pose.shape[-2:] == (4, 4):
        raise ValueError('Input size must be a Nx4x4 tensor. Got {}'.format
            (pose.shape))
    r_mat = pose[..., :3, 0:3]
    t_vec = pose[..., :3, 3:4]
    r_mat_trans = torch.transpose(r_mat, 1, 2)
    pose_inv = pose.new_zeros(pose.shape) + eps
    pose_inv[..., :3, 0:3] = r_mat_trans
    pose_inv[..., :3, 3:4] = torch.matmul(-1.0 * r_mat_trans, t_vec)
    pose_inv[..., 3, 3] = 1.0
    return pose_inv


class InversePoseNew(nn.Module):
    """Creates a transformation that inverts a 4x4 pose.

    Args:
        points (Tensor): tensor with poses.

    Returns:
        Tensor: tensor with inverted poses.

    Shape:
        - Input: :math:`(N, 4, 4)`
        - Output: :math:`(N, 4, 4)`

    Example:
        >>> pose = torch.rand(1, 4, 4)  # Nx4x4
        >>> transform = tgm.InversePose()
        >>> pose_inv = transform(pose)  # Nx4x4
    """

    def __init__(self):
        super(InversePoseNew, self).__init__()

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