def move_to_ctx(arr, ctx):
    """Move a nested structure of array to the given context

    Parameters
    ----------
    arr
        The input array
    ctx
        The MXNet context

    Returns
    -------
    new_arr
        The array that has been moved to context
    """
    if isinstance(arr, tuple):
        return tuple(move_to_ctx(ele, ctx) for ele in arr)
    elif isinstance(arr, list):
        return [move_to_ctx(ele, ctx) for ele in arr]
    else:
        return None if arr is None else arr.as_in_ctx(ctx)