def METHOD_NAME(ctx: Any, *x: Any) -> Any:  # type: ignore
    # ctx.xdtype = [xi.dtype for xi in x]
    ctx.xdtype = backend.tree_map(lambda s: s.dtype, x)
    # (x, )
    if len(ctx.xdtype) == 1:
        ctx.xdtype = ctx.xdtype[0]
    ctx.device = (backend.tree_flatten(x)[0][0]).device
    x = general_args_to_backend(x, enable_dlpack=enable_dlpack)
    y = fun(*x)
    ctx.ydtype = backend.tree_map(lambda s: s.dtype, y)
    if len(x) == 1:
        x = x[0]
    ctx.x = x
    y = general_args_to_backend(
        y, target_backend="pytorch", enable_dlpack=enable_dlpack
    )
    y = backend.tree_map(lambda s: s.to(device=ctx.device), y)
    return y