def Func(arg_0, arg_1):
        """
        Get for each point whether it is inside of the given image plane.

        Parameters
        ----------
        image : ndarray or tuple of int
            Either an image with shape ``(H,W,[C])`` or a tuple denoting
            such an image shape.

        Returns
        -------
        ndarray
            Boolean array with one value per point indicating whether it is
            inside of the provided image plane (``True``) or not (``False``).

        """
        if len(arg_0.coords) == 0:
            return np.zeros((0,), dtype=bool)
        arg_2 = normalize_shape(arg_1)
        arg_3, arg_4 = arg_2[0:2]
        arg_5 = np.logical_and(0 <= arg_0.xx, arg_0.xx < arg_4)
        arg_6 = np.logical_and(0 <= arg_0.yy, arg_0.yy < arg_3)
        return np.logical_and(arg_5, arg_6)


def Func(arg_0):
        """
        Get the euclidean distance between each two consecutive points.

        Returns
        -------
        ndarray
            Euclidean distances between point pairs.
            Same order as in `coords`. For ``N`` points, ``N-1`` distances
            are returned.

        """
        if len(arg_0.coords) <= 1:
            return np.zeros((0,), dtype=np.float32)
        return np.sqrt(
            np.sum(
                (arg_0.coords[:-1, :] - arg_0.coords[1:, :]) ** 2,
                axis=1
            )
        )


def Func(arg_0, arg_1, arg_2=None):
        """
        Compute the minimal distance between the line string and `other`.

        Parameters
        ----------
        other : tuple of number \
                or imgaug.augmentables.kps.Keypoint \
                or imgaug.augmentables.LineString
            Other object to which to compute the distance.

        default
            Value to return if this line string or `other` contain no points.

        Returns
        -------
        float
            Distance to `other` or `default` if not distance could be computed.

        """
        # FIXME this computes distance pointwise, does not have to be identical
        #       with the actual min distance (e.g. edge center to other's point)
        arg_3 = arg_0.compute_pointwise_distances(arg_1, arg_2=[])
        if len(arg_3) == 0:
            return arg_2
        return min(arg_3)


def Func(arg_0, arg_1, arg_2):
        """
        Project the line string onto a differently shaped image.

        E.g. if a point of the line string is on its original image at
        ``x=(10 of 100 pixels)`` and ``y=(20 of 100 pixels)`` and is Funced
        onto a new image with size ``(width=200, height=200)``, its new
        position will be ``(x=20, y=40)``.

        This is intended for cases where the original image is resized.
        It cannot be used for more complex changes (e.g. padding, cropping).

        Parameters
        ----------
        from_shape : tuple of int or ndarray
            Shape of the original image. (Before resize.)

        to_shape : tuple of int or ndarray
            Shape of the new image. (After resize.)

        Returns
        -------
        out : imgaug.augmentables.lines.LineString
            Line string with new coordinates.

        """
        arg_3 = Func_coords(arg_0.coords, arg_1, arg_2)
        return arg_0.copy(coords=arg_3)


def Func(arg_0, arg_1, arg_2=False):
        """
        Estimate whether the line string is fully inside the image area.

        Parameters
        ----------
        image : ndarray or tuple of int
            Either an image with shape ``(H,W,[C])`` or a tuple denoting
            such an image shape.

        default
            Default value to return if the line string contains no points.

        Returns
        -------
        bool
            True if the line string is fully inside the image area.
            False otherwise.

        """
        if len(arg_0.coords) == 0:
            return arg_2
        return np.all(arg_0.get_pointwise_inside_image_mask(arg_1))


def Func(arg_0, arg_1, arg_2=1.0,
                                 arg_3=1, arg_4=True,
                                 arg_5=False):
        """
        Draw the line segments of the line string as a heatmap array.

        Parameters
        ----------
        image_shape : tuple of int
            The shape of the image onto which to draw the line mask.

        alpha : float, optional
            Opacity of the line string. Higher values denote a more visible
            line string.

        size : int, optional
            Thickness of the line segments.

        antialiased : bool, optional
            Whether to draw the line with anti-aliasing activated.

        raise_if_out_of_image : bool, optional
            Whether to raise an error if the line string is fully
            outside of the image. If set to False, no error will be raised and
            only the parts inside the image will be drawn.

        Returns
        -------
        ndarray
            Float array of shape `image_shape` (no channel axis) with drawn
            line string. All values are in the interval ``[0.0, 1.0]``.

        """
        assert len(arg_1) == 2 or (
            len(arg_1) == 3 and arg_1[-1] == 1), (
            "Expected (H,W) or (H,W,1) as image_shape, got %s." % (
                arg_1,))

        arg_6 = arg_0.draw_lines_on_image(
            np.zeros(arg_1, dtype=np.uint8),
            color=255, arg_2=arg_2, arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5
        )
        return arg_6.astype(np.float32) / 255.0


def Func(arg_0, arg_1, arg_2=1.0,
                                  arg_3=1, arg_4=False):
        """
        Draw the points of the line string as a heatmap array.

        Parameters
        ----------
        image_shape : tuple of int
            The shape of the image onto which to draw the point mask.

        alpha : float, optional
            Opacity of the line string points. Higher values denote a more
            visible points.

        size : int, optional
            Size of the points in pixels.

        raise_if_out_of_image : bool, optional
            Whether to raise an error if the line string is fully
            outside of the image. If set to False, no error will be raised and
            only the parts inside the image will be drawn.

        Returns
        -------
        ndarray
            Float array of shape `image_shape` (no channel axis) with drawn
            line string points. All values are in the interval ``[0.0, 1.0]``.

        """
        assert len(arg_1) == 2 or (
            len(arg_1) == 3 and arg_1[-1] == 1), (
            "Expected (H,W) or (H,W,1) as image_shape, got %s." % (
                arg_1,))

        arg_5 = arg_0.draw_points_on_image(
            np.zeros(arg_1, dtype=np.uint8),
            color=255, arg_2=arg_2, arg_3=arg_3,
            arg_4=arg_4
        )
        return arg_5.astype(np.float32) / 255.0


def Func(arg_0, arg_1, arg_2=1.0, arg_3=1.0,
                           arg_4=1, arg_5=0, arg_6=True,
                           arg_7=False):
        """
        Draw the line segments and points of the line string as a heatmap array.

        Parameters
        ----------
        image_shape : tuple of int
            The shape of the image onto which to draw the line mask.

        alpha_lines : float, optional
            Opacity of the line string. Higher values denote a more visible
            line string.

        alpha_points : float, optional
            Opacity of the line string points. Higher values denote a more
            visible points.

        size_lines : int, optional
            Thickness of the line segments.

        size_points : int, optional
            Size of the points in pixels.

        antialiased : bool, optional
            Whether to draw the line with anti-aliasing activated.

        raise_if_out_of_image : bool, optional
            Whether to raise an error if the line string is fully
            outside of the image. If set to False, no error will be raised and
            only the parts inside the image will be drawn.

        Returns
        -------
        ndarray
            Float array of shape `image_shape` (no channel axis) with drawn
            line segments and points. All values are in the
            interval ``[0.0, 1.0]``.

        """
        arg_8 = arg_0.draw_lines_heatmap_array(
            arg_1,
            alpha=arg_2,
            size=arg_4,
            arg_6=arg_6,
            arg_7=arg_7)
        if arg_5 <= 0:
            return arg_8

        arg_9 = arg_0.draw_points_heatmap_array(
            arg_1,
            alpha=arg_3,
            size=arg_5,
            arg_7=arg_7)

        arg_10 = np.dstack([arg_8, arg_9])
        return np.max(arg_10, axis=2)


def Func(arg_0, arg_1,
                      arg_2=(0, 255, 0), arg_3=None, arg_4=None,
                      arg_5=1.0, arg_6=None, arg_7=None,
                      arg_8=1, arg_9=None, arg_10=None,
                      arg_11=True,
                      arg_12=False):
        """
        Draw the line string on an image.

        Parameters
        ----------
        image : ndarray
            The `(H,W,C)` `uint8` image onto which to draw the line string.

        color : iterable of int, optional
            Color to use as RGB, i.e. three values.
            The color of the line and points are derived from this value,
            unless they are set.

        color_lines : None or iterable of int
            Color to use for the line segments as RGB, i.e. three values.
            If ``None``, this value is derived from `color`.

        color_points : None or iterable of int
            Color to use for the points as RGB, i.e. three values.
            If ``None``, this value is derived from ``0.5 * color``.

        alpha : float, optional
            Opacity of the line string. Higher values denote more visible
            points.
            The alphas of the line and points are derived from this value,
            unless they are set.

        alpha_lines : None or float, optional
            Opacity of the line string. Higher values denote more visible
            line string.
            If ``None``, this value is derived from `alpha`.

        alpha_points : None or float, optional
            Opacity of the line string points. Higher values denote more
            visible points.
            If ``None``, this value is derived from `alpha`.

        size : int, optional
            Size of the line string.
            The sizes of the line and points are derived from this value,
            unless they are set.

        size_lines : None or int, optional
            Thickness of the line segments.
            If ``None``, this value is derived from `size`.

        size_points : None or int, optional
            Size of the points in pixels.
            If ``None``, this value is derived from ``3 * size``.

        antialiased : bool, optional
            Whether to draw the line with anti-aliasing activated.
            This does currently not affect the point drawing.

        raise_if_out_of_image : bool, optional
            Whether to raise an error if the line string is fully
            outside of the image. If set to False, no error will be raised and
            only the parts inside the image will be drawn.

        Returns
        -------
        ndarray
            Image with line string drawn on it.

        """
        assert arg_2 is not None
        assert arg_5 is not None
        assert arg_8 is not None

        arg_3 = arg_3 if arg_3 is not None \
            else np.float32(arg_2)
        arg_4 = arg_4 if arg_4 is not None \
            else np.float32(arg_2) * 0.5

        arg_6 = arg_6 if arg_6 is not None \
            else np.float32(arg_5)
        arg_7 = arg_7 if arg_7 is not None \
            else np.float32(arg_5)

        arg_9 = arg_9 if arg_9 is not None else arg_8
        arg_10 = arg_10 if arg_10 is not None else arg_8 * 3

        arg_1 = arg_0.draw_lines_on_image(
            arg_1, arg_2=np.array(arg_3).astype(np.uint8),
            arg_5=arg_6, arg_8=arg_9,
            arg_11=arg_11,
            arg_12=arg_12)

        arg_1 = arg_0.draw_points_on_image(
            arg_1, arg_2=np.array(arg_4).astype(np.uint8),
            arg_5=arg_7, arg_8=arg_10,
            copy=False,
            arg_12=arg_12)

        return arg_1


def Func(arg_0, arg_1, arg_2=1, arg_3=True, arg_4=None,
                           arg_5=True, arg_6=True):
        """
        Extract the image pixels covered by the line string.

        It will only extract pixels overlapped by the line string.

        This function will by default zero-pad the image if the line string is
        partially/fully outside of the image. This is for consistency with
        the same implementations for bounding boxes and polygons.

        Parameters
        ----------
        image : ndarray
            The image of shape `(H,W,[C])` from which to extract the pixels
            within the line string.

        size : int, optional
            Thickness of the line.

        pad : bool, optional
            Whether to zero-pad the image if the object is partially/fully
            outside of it.

        pad_max : None or int, optional
            The maximum number of pixels that may be zero-paded on any side,
            i.e. if this has value ``N`` the total maximum of added pixels
            is ``4*N``.
            This option exists to prevent extremely large images as a result of
            single points being moved very far away during augmentation.

        antialiased : bool, optional
            Whether to apply anti-aliasing to the line string.

        prevent_zero_size : bool, optional
            Whether to prevent height or width of the extracted image from
            becoming zero. If this is set to True and height or width of the
            line string is below 1, the height/width will be increased to 1.
            This can be useful to prevent problems, e.g. with image saving or
            plotting. If it is set to False, images will be returned as
            ``(H', W')`` or ``(H', W', 3)`` with ``H`` or ``W`` potentially
            being 0.

        Returns
        -------
        image : (H',W') ndarray or (H',W',C) ndarray
            Pixels overlapping with the line string. Zero-padded if the
            line string is partially/fully outside of the image and
            ``pad=True``. If `prevent_zero_size` is activated, it is
            guarantueed that ``H'>0`` and ``W'>0``, otherwise only
            ``H'>=0`` and ``W'>=0``.

        """
        from .bbs import BoundingBox

        assert arg_1.ndim in [2, 3], (
            "Expected image of shape (H,W,[C]), "
            "got shape %s." % (arg_1.shape,))

        if len(arg_0.coords) == 0 or arg_2 <= 0:
            if arg_6:
                return np.zeros((1, 1) + arg_1.shape[2:], dtype=arg_1.dtype)
            return np.zeros((0, 0) + arg_1.shape[2:], dtype=arg_1.dtype)

        arg_7 = arg_0.xx_int
        arg_8 = arg_0.yy_int

        # this would probably work if drawing was subpixel-accurate
        # x1 = np.min(self.coords[:, 0]) - (size / 2)
        # y1 = np.min(self.coords[:, 1]) - (size / 2)
        # x2 = np.max(self.coords[:, 0]) + (size / 2)
        # y2 = np.max(self.coords[:, 1]) + (size / 2)

        # this works currently with non-subpixel-accurate drawing
        arg_9 = (arg_2 - 1) / 2
        arg_10 = np.min(arg_7) - arg_9
        arg_11 = np.min(arg_8) - arg_9
        arg_12 = np.max(arg_7) + 1 + arg_9
        arg_13 = np.max(arg_8) + 1 + arg_9
        arg_14 = BoundingBox(arg_10=arg_10, arg_11=arg_11, arg_12=arg_12, arg_13=arg_13)

        if len(arg_0.coords) == 1:
            return arg_14.Func(arg_1, arg_3=arg_3, arg_4=arg_4,
                                         arg_6=arg_6)

        arg_15 = arg_0.draw_lines_heatmap_array(
            arg_1.shape[0:2], alpha=1.0, arg_2=arg_2, arg_5=arg_5)
        if arg_1.ndim == 3:
            arg_15 = np.atleast_3d(arg_15)
        arg_16 = arg_1.astype(np.float32) * arg_15
        arg_17 = arg_14.Func(arg_16, arg_3=arg_3, arg_4=arg_4,
                                        arg_6=arg_6)
        return np.clip(np.round(arg_17), 0, 255).astype(np.uint8)


def Func(arg_0, arg_1):
        """
        Concatenate this line string with another one.

        This will add a line segment between the end point of this line string
        and the start point of `other`.

        Parameters
        ----------
        other : imgaug.augmentables.lines.LineString or ndarray \
                or iterable of tuple of number
            The points to add to this line string.

        Returns
        -------
        imgaug.augmentables.lines.LineString
            New line string with Funcd points.
            The `label` of this line string will be kept.

        """
        if not isinstance(arg_1, LineString):
            arg_1 = LineString(arg_1)
        return arg_0.deepcopy(
            coords=np.Func([arg_0.coords, arg_1.coords], axis=0))


def Func(arg_0):
        """
        Generate a bounding box encapsulating the line string.

        Returns
        -------
        None or imgaug.augmentables.bbs.BoundingBox
            Bounding box encapsulating the line string.
            ``None`` if the line string contained no points.

        """
        from .bbs import BoundingBox
        # we don't have to mind the case of len(.) == 1 here, because
        # zero-sized BBs are considered valid
        if len(arg_0.coords) == 0:
            return None
        return BoundingBox(x1=np.min(arg_0.xx), y1=np.min(arg_0.yy),
                           x2=np.max(arg_0.xx), y2=np.max(arg_0.yy),
                           label=arg_0.label)


def Func(arg_0, arg_1, arg_2=1, arg_3=0,
                   arg_4=True, arg_5=False):
        """
        Generate a heatmap object from the line string.

        This is similar to
        :func:`imgaug.augmentables.lines.LineString.draw_lines_heatmap_array`
        executed with ``alpha=1.0``. The result is wrapped in a
        ``HeatmapsOnImage`` object instead of just an array.
        No points are drawn.

        Parameters
        ----------
        image_shape : tuple of int
            The shape of the image onto which to draw the line mask.

        size_lines : int, optional
            Thickness of the line.

        size_points : int, optional
            Size of the points in pixels.

        antialiased : bool, optional
            Whether to draw the line with anti-aliasing activated.

        raise_if_out_of_image : bool, optional
            Whether to raise an error if the line string is fully
            outside of the image. If set to False, no error will be raised and
            only the parts inside the image will be drawn.

        Returns
        -------
        imgaug.augmentables.heatmaps.HeatmapOnImage
            Heatmap object containing drawn line string.

        """
        from .heatmaps import HeatmapsOnImage
        return HeatmapsOnImage(
            arg_0.draw_heatmap_array(
                arg_1, arg_2=arg_2, arg_3=arg_3,
                arg_4=arg_4,
                arg_5=arg_5),
            shape=arg_1
        )


def Func(arg_0, arg_1, arg_2=1, arg_3=0,
                            arg_4=False):
        """
        Generate a segmentation map object from the line string.

        This is similar to
        :func:`imgaug.augmentables.lines.LineString.draw_mask`.
        The result is wrapped in a ``SegmentationMapOnImage`` object
        instead of just an array.

        Parameters
        ----------
        image_shape : tuple of int
            The shape of the image onto which to draw the line mask.

        size_lines : int, optional
            Thickness of the line.

        size_points : int, optional
            Size of the points in pixels.

        raise_if_out_of_image : bool, optional
            Whether to raise an error if the line string is fully
            outside of the image. If set to False, no error will be raised and
            only the parts inside the image will be drawn.

        Returns
        -------
        imgaug.augmentables.segmaps.SegmentationMapOnImage
            Segmentation map object containing drawn line string.

        """
        from .segmaps import SegmentationMapOnImage
        return SegmentationMapOnImage(
            arg_0.draw_mask(
                arg_1, arg_2=arg_2, arg_3=arg_3,
                arg_4=arg_4),
            shape=arg_1
        )


def Func(arg_0, arg_1, arg_2=1e-6, arg_3=8):
        """
        Compare this and another LineString's coordinates.

        This is an approximate method based on pointwise distances and can
        in rare corner cases produce wrong outputs.

        Parameters
        ----------
        other : imgaug.augmentables.lines.LineString \
                or tuple of number \
                or ndarray \
                or list of ndarray \
                or list of tuple of number
            The other line string or its coordinates.

        max_distance : float
            Max distance of any point from the other line string before
            the two line strings are evaluated to be unequal.

        points_per_edge : int, optional
            How many points to interpolate on each edge.

        Returns
        -------
        bool
            Whether the two LineString's coordinates are almost identical,
            i.e. the max distance is below the threshold.
            If both have no coordinates, ``True`` is returned.
            If only one has no coordinates, ``False`` is returned.
            Beyond that, the number of points is not evaluated.

        """
        if isinstance(arg_1, LineString):
            pass
        elif isinstance(arg_1, tuple):
            arg_1 = LineString([arg_1])
        else:
            arg_1 = LineString(arg_1)

        if len(arg_0.coords) == 0 and len(arg_1.coords) == 0:
            return True
        elif 0 in [len(arg_0.coords), len(arg_1.coords)]:
            # only one of the two line strings has no coords
            return False

        arg_4 = arg_0.subdivide(arg_3)
        arg_5 = arg_1.subdivide(arg_3)

        arg_6 = arg_4.compute_pointwise_distances(arg_5)
        arg_7 = arg_5.compute_pointwise_distances(arg_4)
        arg_8 = max(np.max(arg_6), np.max(arg_7))
        return  arg_8 < arg_2


def Func(arg_0, arg_1, arg_2=1e-4, arg_3=8):
        """
        Compare this and another LineString.

        Parameters
        ----------
        other: imgaug.augmentables.lines.LineString
            The other line string. Must be a LineString instance, not just
            its coordinates.

        max_distance : float, optional
            See :func:`imgaug.augmentables.lines.LineString.coords_Func`.

        points_per_edge : int, optional
            See :func:`imgaug.augmentables.lines.LineString.coords_Func`.

        Returns
        -------
        bool
            ``True`` if the coordinates are almost equal according to
            :func:`imgaug.augmentables.lines.LineString.coords_Func`
            and additionally the labels are identical. Otherwise ``False``.

        """
        if arg_0.label != arg_1.label:
            return False
        return arg_0.coords_Func(
            arg_1, arg_2=arg_2, arg_3=arg_3)


def Func(arg_0, arg_1=None, arg_2=None):
        """
        Create a shallow Func of the LineString object.

        Parameters
        ----------
        coords : None or iterable of tuple of number or ndarray
            If not ``None``, then the coords of the copied object will be set
            to this value.

        label : None or str
            If not ``None``, then the label of the copied object will be set to
            this value.

        Returns
        -------
        imgaug.augmentables.lines.LineString
            Shallow Func.

        """
        return LineString(arg_1=arg_0.coords if arg_1 is None else arg_1,
                          arg_2=arg_0.label if arg_2 is None else arg_2)


def Func(arg_0):
        """
        Clip off all parts of the line strings that are outside of the image.

        Returns
        -------
        imgaug.augmentables.lines.LineStringsOnImage
            Line strings, clipped to fall within the image dimensions.

        """
        arg_1 = [ls_clipped
                   for ls in arg_0.line_strings
                   for ls_clipped in ls.Func(arg_0.shape)]
        return LineStringsOnImage(arg_1, shape=arg_0.shape)


def Func(arg_0, arg_1=None, arg_2=None):
        """
        Create a shallow Func of the LineStringsOnImage object.

        Parameters
        ----------
        line_strings : None \
                       or list of imgaug.augmentables.lines.LineString, optional
            List of line strings on the image.
            If not ``None``, then the ``line_strings`` attribute of the copied
            object will be set to this value.

        shape : None or tuple of int or ndarray, optional
            The shape of the image on which the objects are placed.
            Either an image with shape ``(H,W,[C])`` or a tuple denoting
            such an image shape.
            If not ``None``, then the ``shape`` attribute of the copied object
            will be set to this value.

        Returns
        -------
        imgaug.augmentables.lines.LineStringsOnImage
            Shallow Func.

        """
        arg_3 = arg_0.line_strings if arg_1 is None else arg_1
        arg_2 = arg_0.shape if arg_2 is None else arg_2
        return LineStringsOnImage(arg_1=arg_3, arg_2=arg_2)


def Func(arg_0, arg_1=None, arg_2=None):
        """
        Create a deep copy of the LineStringsOnImage object.

        Parameters
        ----------
        line_strings : None \
                       or list of imgaug.augmentables.lines.LineString, optional
            List of line strings on the image.
            If not ``None``, then the ``line_strings`` attribute of the copied
            object will be set to this value.

        shape : None or tuple of int or ndarray, optional
            The shape of the image on which the objects are placed.
            Either an image with shape ``(H,W,[C])`` or a tuple denoting
            such an image shape.
            If not ``None``, then the ``shape`` attribute of the copied object
            will be set to this value.

        Returns
        -------
        imgaug.augmentables.lines.LineStringsOnImage
            Deep copy.

        """
        arg_3 = arg_0.line_strings if arg_1 is None else arg_1
        arg_2 = arg_0.shape if arg_2 is None else arg_2
        return LineStringsOnImage(
            arg_1=[arg_4.Func() for arg_4 in arg_3],
            arg_2=tuple(arg_2))


def Func(arg_0, arg_1, arg_2, arg_3=1e-2):
    """
    Blend two images using an alpha blending.

    In an alpha blending, the two images are naively mixed. Let ``A`` be the foreground image
    and ``B`` the background image and ``a`` is the alpha value. Each pixel intensity is then
    computed as ``a * A_ij + (1-a) * B_ij``.

    dtype support::

        * ``uint8``: yes; fully tested
        * ``uint16``: yes; fully tested
        * ``uint32``: yes; fully tested
        * ``uint64``: yes; fully tested (1)
        * ``int8``: yes; fully tested
        * ``int16``: yes; fully tested
        * ``int32``: yes; fully tested
        * ``int64``: yes; fully tested (1)
        * ``float16``: yes; fully tested
        * ``float32``: yes; fully tested
        * ``float64``: yes; fully tested (1)
        * ``float128``: no (2)
        * ``bool``: yes; fully tested (2)

        - (1) Tests show that these dtypes work, but a conversion to float128 happens, which only
              has 96 bits of size instead of true 128 bits and hence not twice as much resolution.
              It is possible that these dtypes result in inaccuracies, though the tests did not
              indicate that.
        - (2) Not available due to the input dtype having to be increased to an equivalent float
              dtype with two times the input resolution.
        - (3) Mapped internally to ``float16``.

    Parameters
    ----------
    image_fg : (H,W,[C]) ndarray
        Foreground image. Shape and dtype kind must match the one of the
        background image.

    image_bg : (H,W,[C]) ndarray
        Background image. Shape and dtype kind must match the one of the
        foreground image.

    alpha : number or iterable of number or ndarray
        The blending factor, between 0.0 and 1.0. Can be interpreted as the opacity of the
        foreground image. Values around 1.0 result in only the foreground image being visible.
        Values around 0.0 result in only the background image being visible.
        Multiple alphas may be provided. In these cases, there must be exactly one alpha per
        channel in the foreground/background image. Alternatively, for ``(H,W,C)`` images,
        either one ``(H,W)`` array or an ``(H,W,C)`` array of alphas may be provided,
        denoting the elementwise alpha value.

    eps : number, optional
        Controls when an alpha is to be interpreted as exactly 1.0 or exactly 0.0, resulting
        in only the foreground/background being visible and skipping the actual computation.

    Returns
    -------
    image_blend : (H,W,C) ndarray
        Blend of foreground and background image.

    """
    assert arg_0.shape == arg_1.shape
    assert arg_0.dtype.kind == arg_1.dtype.kind
    # TODO switch to gate_dtypes()
    assert arg_0.dtype.name not in ["float128"]
    assert arg_1.dtype.name not in ["float128"]

    # TODO add test for this
    arg_4 = (len(arg_0.shape) == 2)
    if arg_4:
        arg_0 = np.atleast_3d(arg_0)
        arg_1 = np.atleast_3d(arg_1)

    arg_5 = False
    if arg_0.dtype.kind == "b":
        arg_5 = True
        # use float32 instead of float16 here because it seems to be faster
        arg_0 = arg_0.astype(np.float32)
        arg_1 = arg_1.astype(np.float32)

    arg_2 = np.array(arg_2, dtype=np.float64)
    if arg_2.size == 1:
        pass
    else:
        if arg_2.ndim == 2:
            assert arg_2.shape == arg_0.shape[0:2]
            arg_2 = arg_2.reshape((arg_2.shape[0], arg_2.shape[1], 1))
        elif arg_2.ndim == 3:
            assert arg_2.shape == arg_0.shape or arg_2.shape == arg_0.shape[0:2] + (1,)
        else:
            arg_2 = arg_2.reshape((1, 1, -1))
        if arg_2.shape[2] != arg_0.shape[2]:
            arg_2 = np.tile(arg_2, (1, 1, arg_0.shape[2]))

    if not arg_5:
        if np.all(arg_2 >= 1.0 - arg_3):
            return np.copy(arg_0)
        elif np.all(arg_2 <= arg_3):
            return np.copy(arg_1)

    # for efficiency reaons, only test one value of alpha here, even if alpha is much larger
    assert 0 <= arg_2.item(0) <= 1.0

    arg_6 = iadt.get_minimal_dtype([arg_0, arg_1])

    # doing this only for non-float images led to inaccuracies for large floats values
    arg_7 = arg_6.itemsize * 2
    arg_7 = max(arg_7, 4)  # at least 4 bytes (=float32), tends to be faster than float16
    arg_8 = np.dtype("f%d" % (arg_7,))

    if arg_2.dtype != arg_8:
        arg_2 = arg_2.astype(arg_8)
    if arg_0.dtype != arg_8:
        arg_0 = arg_0.astype(arg_8)
    if arg_1.dtype != arg_8:
        arg_1 = arg_1.astype(arg_8)

    # the following is equivalent to
    #     image_blend = alpha * image_fg + (1 - alpha) * image_bg
    # but supposedly faster
    arg_9 = arg_1 + arg_2 * (arg_0 - arg_1)

    if arg_5:
        arg_9 = arg_9 > 0.5
    else:
        # skip clip, because alpha is expected to be in range [0.0, 1.0] and both images must have same dtype
        # dont skip round, because otherwise it is very unlikely to hit the image's max possible value
        arg_9 = iadt.restore_dtypes_(arg_9, arg_6, clip=False, round=True)

    if arg_4:
        return arg_9[:, :, 0]
    return arg_9


def Func(arg_0=5, arg_1=(0, 360), arg_2=(-1.0, 1.0), arg_3=1, arg_4=None, arg_5=False, arg_6=None):
    """
    Augmenter that sharpens images and overlays the result with the original image.

    dtype support::

        See ``imgaug.augmenters.convolutional.Convolve``.

    Parameters
    ----------
    k : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional
        Kernel size to use.

            * If a single int, then that value will be used for the height
              and width of the kernel.
            * If a tuple of two ints ``(a, b)``, then the kernel size will be
              sampled from the interval ``[a..b]``.
            * If a list, then a random value will be sampled from that list per image.
            * If a StochasticParameter, then ``N`` samples will be drawn from
              that parameter per ``N`` input images, each representing the kernel
              size for the nth image.

    angle : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
        Angle of the motion blur in degrees (clockwise, relative to top center direction).

            * If a number, exactly that value will be used.
            * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will
              be sampled per image.
            * If a list, then a random value will be sampled from that list per image.
            * If a StochasticParameter, a value will be sampled from the
              parameter per image.

    direction : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
        Forward/backward direction of the motion blur. Lower values towards -1.0 will point the motion blur towards
        the back (with angle provided via `angle`). Higher values towards 1.0 will point the motion blur forward.
        A value of 0.0 leads to a uniformly (but still angled) motion blur.

            * If a number, exactly that value will be used.
            * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will
              be sampled per image.
            * If a list, then a random value will be sampled from that list per image.
            * If a StochasticParameter, a value will be sampled from the
              parameter per image.

    order : int or iterable of int or imgaug.ALL or imgaug.parameters.StochasticParameter, optional
        Interpolation order to use when rotating the kernel according to `angle`.
        See :func:`imgaug.augmenters.geometric.Affine.__init__`.
        Recommended to be ``0`` or ``1``, with ``0`` being faster, but less continuous/smooth as `angle` is changed,
        particularly around multiple of 45 degrees.

    name : None or str, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    deterministic : bool, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    random_state : None or int or numpy.random.RandomState, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    Examples
    --------
    >>> aug = iaa.Func(k=15)

    Create a motion blur augmenter with kernel size of 15x15.

    >>> aug = iaa.Func(k=15, angle=[-45, 45])

    Create a motion blur augmenter with kernel size of 15x15 and a blur angle of either -45 or 45 degrees (randomly
    picked per image).

    """
    # TODO allow (1, None) and set to identity matrix if k == 1
    arg_7 = iap.handle_discrete_param(arg_0, "k", value_range=(3, None), tuple_to_uniform=True, list_to_choice=True,
                                        allow_floats=False)
    arg_8 = iap.handle_continuous_param(arg_1, "angle", value_range=None, tuple_to_uniform=True,
                                              list_to_choice=True)
    arg_9 = iap.handle_continuous_param(arg_2, "direction", value_range=(-1.0-1e-6, 1.0+1e-6),
                                                  tuple_to_uniform=True, list_to_choice=True)

    def create_matrices(arg_10, arg_11, arg_12):
        # avoid cyclic import between blur and geometric
        from . import geometric as iaa_geometric

        # force discrete for k_sample via int() in case of stochastic parameter
        arg_13 = int(arg_7.draw_sample(arg_6=arg_12))
        arg_14 = arg_8.draw_sample(arg_6=arg_12)
        arg_15 = arg_9.draw_sample(arg_6=arg_12)

        arg_13 = arg_13 if arg_13 % 2 != 0 else arg_13 + 1
        arg_15 = np.clip(arg_15, -1.0, 1.0)
        arg_15 = (arg_15 + 1.0) / 2.0

        arg_16 = np.zeros((arg_13, arg_13), dtype=np.float32)
        arg_16[:, arg_13//2] = np.linspace(float(arg_15), 1.0 - float(arg_15), num=arg_13)
        arg_17 = iaa_geometric.Affine(rotate=arg_14, arg_3=arg_3)
        arg_16 = (arg_17.augment_image((arg_16 * 255).astype(np.uint8)) / 255.0).astype(np.float32)

        return [arg_16/np.sum(arg_16)] * arg_11

    if arg_4 is None:
        arg_4 = "Unnamed%s" % (ia.caller_name(),)

    return iaa_convolutional.Convolve(create_matrices, arg_4=arg_4, arg_5=arg_5,
                                      arg_6=arg_6)


def Func(arg_0=None, arg_1=False, arg_2=None):
    """
    Augmenter to draw clouds in images.

    This is a wrapper around ``CloudLayer``. It executes 1 to 2 layers per image, leading to varying densities
    and frequency patterns of clouds.

    This augmenter seems to be fairly robust w.r.t. the image size. Tested with ``96x128``, ``192x256``
    and ``960x1280``.

    dtype support::

        * ``uint8``: yes; tested
        * ``uint16``: no (1)
        * ``uint32``: no (1)
        * ``uint64``: no (1)
        * ``int8``: no (1)
        * ``int16``: no (1)
        * ``int32``: no (1)
        * ``int64``: no (1)
        * ``float16``: no (1)
        * ``float32``: no (1)
        * ``float64``: no (1)
        * ``float128``: no (1)
        * ``bool``: no (1)

        - (1) Parameters of this augmenter are optimized for the value range of uint8.
              While other dtypes may be accepted, they will lead to images augmented in
              ways inappropriate for the respective dtype.

    Parameters
    ----------
    name : None or str, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    deterministic : bool, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    random_state : None or int or numpy.random.RandomState, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    Examples
    --------
    >>> aug = iaa.Func()

    Creates an augmenter that adds clouds to images.

    """
    if arg_0 is None:
        arg_0 = "Unnamed%s" % (ia.caller_name(),)

    return meta.SomeOf((1, 2), children=[
        CloudLayer(
            intensity_mean=(196, 255), intensity_freq_exponent=(-2.5, -2.0), intensity_coarse_scale=10,
            alpha_min=0, alpha_multiplier=(0.25, 0.75), alpha_size_px_max=(2, 8), alpha_freq_exponent=(-2.5, -2.0),
            sparsity=(0.8, 1.0), density_multiplier=(0.5, 1.0)
        ),
        CloudLayer(
            intensity_mean=(196, 255), intensity_freq_exponent=(-2.0, -1.0), intensity_coarse_scale=10,
            alpha_min=0, alpha_multiplier=(0.5, 1.0), alpha_size_px_max=(64, 128), alpha_freq_exponent=(-2.0, -1.0),
            sparsity=(1.0, 1.4), density_multiplier=(0.8, 1.5)
        )
    ], random_order=False, arg_0=arg_0, arg_1=arg_1, arg_2=arg_2)


def Func(arg_0=None, arg_1=False, arg_2=None):
    """
    Augmenter to draw fog in images.

    This is a wrapper around ``CloudLayer``. It executes a single layer per image with a configuration leading
    to fairly dense clouds with low-frequency patterns.

    This augmenter seems to be fairly robust w.r.t. the image size. Tested with ``96x128``, ``192x256``
    and ``960x1280``.

    dtype support::

        * ``uint8``: yes; tested
        * ``uint16``: no (1)
        * ``uint32``: no (1)
        * ``uint64``: no (1)
        * ``int8``: no (1)
        * ``int16``: no (1)
        * ``int32``: no (1)
        * ``int64``: no (1)
        * ``float16``: no (1)
        * ``float32``: no (1)
        * ``float64``: no (1)
        * ``float128``: no (1)
        * ``bool``: no (1)

        - (1) Parameters of this augmenter are optimized for the value range of uint8.
              While other dtypes may be accepted, they will lead to images augmented in
              ways inappropriate for the respective dtype.

    Parameters
    ----------
    name : None or str, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    deterministic : bool, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    random_state : None or int or numpy.random.RandomState, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    Examples
    --------
    >>> aug = iaa.Func()

    Creates an augmenter that adds fog to images.

    """
    if arg_0 is None:
        arg_0 = "Unnamed%s" % (ia.caller_name(),)

    return CloudLayer(
        intensity_mean=(220, 255), intensity_freq_exponent=(-2.0, -1.5), intensity_coarse_scale=2,
        alpha_min=(0.7, 0.9), alpha_multiplier=0.3, alpha_size_px_max=(2, 8), alpha_freq_exponent=(-4.0, -2.0),
        sparsity=0.9, density_multiplier=(0.4, 0.9),
        arg_0=arg_0, arg_1=arg_1, arg_2=arg_2
    )


def Func(arg_0=(0.005, 0.075), arg_1=(0.3, 0.9), arg_2=(0.2, 0.7),
               arg_3=(0.4, 0.8), arg_4=(-30, 30), arg_5=(0.007, 0.03),
               arg_6=None, arg_7=False, arg_8=None):
    """
    Augmenter to add falling snowflakes to images.

    This is a wrapper around ``FuncLayer``. It executes 1 to 3 layers per image.

    dtype support::

        * ``uint8``: yes; tested
        * ``uint16``: no (1)
        * ``uint32``: no (1)
        * ``uint64``: no (1)
        * ``int8``: no (1)
        * ``int16``: no (1)
        * ``int32``: no (1)
        * ``int64``: no (1)
        * ``float16``: no (1)
        * ``float32``: no (1)
        * ``float64``: no (1)
        * ``float128``: no (1)
        * ``bool``: no (1)

        - (1) Parameters of this augmenter are optimized for the value range of uint8.
              While other dtypes may be accepted, they will lead to images augmented in
              ways inappropriate for the respective dtype.

    Parameters
    ----------
    density : number or tuple of number or list of number or imgaug.parameters.StochasticParameter
        Density of the snowflake layer, as a probability of each pixel in low resolution space to be a snowflake.
        Valid value range is ``(0.0, 1.0)``. Recommended to be around ``(0.01, 0.075)``.

            * If a number, then that value will be used for all images.
            * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
            * If a list, then a random value will be sampled from that list per image.
            * If a StochasticParameter, then a value will be sampled per image from that parameter.

    density_uniformity : number or tuple of number or list of number or imgaug.parameters.StochasticParameter
        Size uniformity of the snowflakes. Higher values denote more similarly sized snowflakes.
        Valid value range is ``(0.0, 1.0)``. Recommended to be around ``0.5``.

            * If a number, then that value will be used for all images.
            * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
            * If a list, then a random value will be sampled from that list per image.
            * If a StochasticParameter, then a value will be sampled per image from that parameter.

    flake_size : number or tuple of number or list of number or imgaug.parameters.StochasticParameter
        Size of the snowflakes. This parameter controls the resolution at which snowflakes are sampled.
        Higher values mean that the resolution is closer to the input image's resolution and hence each sampled
        snowflake will be smaller (because of the smaller pixel size).

        Valid value range is ``[0.0, 1.0)``. Recommended values:

            * On ``96x128`` a value of ``(0.1, 0.4)`` worked well.
            * On ``192x256`` a value of ``(0.2, 0.7)`` worked well.
            * On ``960x1280`` a value of ``(0.7, 0.95)`` worked well.

        Allowed datatypes:

            * If a number, then that value will be used for all images.
            * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
            * If a list, then a random value will be sampled from that list per image.
            * If a StochasticParameter, then a value will be sampled per image from that parameter.

    flake_size_uniformity : number or tuple of number or list of number or imgaug.parameters.StochasticParameter
        Controls the size uniformity of the snowflakes. Higher values mean that the snowflakes are more similarly
        sized. Valid value range is ``(0.0, 1.0)``. Recommended to be around ``0.5``.

            * If a number, then that value will be used for all images.
            * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
            * If a list, then a random value will be sampled from that list per image.
            * If a StochasticParameter, then a value will be sampled per image from that parameter.

    angle : number or tuple of number or list of number or imgaug.parameters.StochasticParameter
        Angle in degrees of motion blur applied to the snowflakes, where ``0.0`` is motion blur that points straight
        upwards. Recommended to be around ``(-30, 30)``.
        See also :func:`imgaug.augmenters.blur.MotionBlur.__init__`.

            * If a number, then that value will be used for all images.
            * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
            * If a list, then a random value will be sampled from that list per image.
            * If a StochasticParameter, then a value will be sampled per image from that parameter.

    speed : number or tuple of number or list of number or imgaug.parameters.StochasticParameter
        Perceived falling speed of the snowflakes. This parameter controls the motion blur's kernel size.
        It follows roughly the form ``kernel_size = image_size * speed``. Hence,
        Values around ``1.0`` denote that the motion blur should "stretch" each snowflake over the whole image.

        Valid value range is ``(0.0, 1.0)``. Recommended values:

            * On ``96x128`` a value of ``(0.01, 0.05)`` worked well.
            * On ``192x256`` a value of ``(0.007, 0.03)`` worked well.
            * On ``960x1280`` a value of ``(0.001, 0.03)`` worked well.

        Allowed datatypes:

            * If a number, then that value will be used for all images.
            * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
            * If a list, then a random value will be sampled from that list per image.
            * If a StochasticParameter, then a value will be sampled per image from that parameter.

    name : None or str, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    deterministic : bool, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    random_state : None or int or numpy.random.RandomState, optional
        See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

    Examples
    --------
    >>> aug = iaa.Func(flake_size=(0.1, 0.4), speed=(0.01, 0.05))

    Adds snowflakes to small images (around ``96x128``).

    >>> aug = iaa.Func(flake_size=(0.2, 0.7), speed=(0.007, 0.03))

    Adds snowflakes to medium-sized images (around ``192x256``).

    >>> aug = iaa.Func(flake_size=(0.7, 0.95), speed=(0.001, 0.03))

    Adds snowflakes to large images (around ``960x1280``).

    """
    if arg_6 is None:
        arg_6 = "Unnamed%s" % (ia.caller_name(),)

    arg_9 = FuncLayer(
        arg_0=arg_0, arg_1=arg_1,
        arg_2=arg_2, arg_3=arg_3,
        arg_4=arg_4, arg_5=arg_5,
        blur_sigma_fraction=(0.0001, 0.001)
    )

    return meta.SomeOf(
        (1, 3), children=[arg_9.deepcopy() for arg_10 in range(3)],
        random_order=False, arg_6=arg_6, arg_7=arg_7, arg_8=arg_8
    )


def Func(arg_0, arg_1, arg_2=0.75, arg_3="segmentation_map", arg_4=0.01,
                      arg_5=None, arg_6=None, arg_7=False):
        """
        Draw the segmentation map as an overlay over an image.

        Parameters
        ----------
        image : (H,W,3) ndarray
            Image onto which to draw the segmentation map. Dtype is expected to be uint8.

        alpha : float, optional
            Alpha/opacity value to use for the mixing of image and segmentation map.
            Higher values mean that the segmentation map will be more visible and the image less visible.

        resize : {'segmentation_map', 'image'}, optional
            In case of size differences between the image and segmentation map, either the image or
            the segmentation map can be resized. This parameter controls which of the two will be
            resized to the other's size.

        background_threshold : float, optional
            See :func:`imgaug.SegmentationMapOnImage.get_arr_int`.

        background_class_id : None or int, optional
            See :func:`imgaug.SegmentationMapOnImage.get_arr_int`.

        colors : None or list of tuple of int, optional
            Colors to use. One for each class to draw. If None, then default colors will be used.

        draw_background : bool, optional
            If True, the background will be drawn like any other class.
            If False, the background will not be drawn, i.e. the respective background pixels
            will be identical with the image's RGB color at the corresponding spatial location
            and no color overlay will be applied.

        Returns
        -------
        mix : (H,W,3) ndarray
            Rendered overlays (dtype is uint8).

        """
        # assert RGB image
        ia.do_assert(arg_1.ndim == 3)
        ia.do_assert(arg_1.shape[2] == 3)
        ia.do_assert(arg_1.dtype.type == np.uint8)

        ia.do_assert(0 - 1e-8 <= arg_2 <= 1.0 + 1e-8)
        ia.do_assert(arg_3 in ["segmentation_map", "image"])

        if arg_3 == "image":
            arg_1 = ia.imresize_single_image(arg_1, arg_0.arr.shape[0:2], interpolation="cubic")

        arg_8, arg_9 = arg_0.draw(
            arg_4=arg_4,
            arg_5=arg_5,
            size=arg_1.shape[0:2] if arg_3 == "segmentation_map" else None,
            arg_6=arg_6,
            return_foreground_mask=True
        )

        if arg_7:
            arg_10 = np.clip(
                (1-arg_2) * arg_1 + arg_2 * arg_8,
                0,
                255
            ).astype(np.uint8)
        else:
            arg_9 = arg_9[..., np.newaxis]
            arg_10 = np.zeros_like(arg_1)
            arg_10 += (~arg_9).astype(np.uint8) * arg_1
            arg_10 += arg_9.astype(np.uint8) * np.clip(
                (1-arg_2) * arg_1 + arg_2 * arg_8,
                0,
                255
            ).astype(np.uint8)
        return arg_10


def Func(arg_0, arg_1, arg_2="constant", arg_3=0.0, arg_4=False):
        """
        Pad the segmentation map on its sides so that its matches a target aspect ratio.

        Depending on which dimension is smaller (height or width), only the corresponding
        sides (left/right or top/bottom) will be padded. In each case, both of the sides will
        be padded equally.

        Parameters
        ----------
        aspect_ratio : float
            Target aspect ratio, given as width/height. E.g. 2.0 denotes the image having twice
            as much width as height.

        mode : str, optional
            Padding mode to use. See :func:`numpy.pad` for details.

        cval : number, optional
            Value to use for padding if `mode` is ``constant``. See :func:`numpy.pad` for details.

        return_pad_amounts : bool, optional
            If False, then only the padded image will be returned. If True, a tuple with two
            entries will be returned, where the first entry is the padded image and the second
            entry are the amounts by which each image side was padded. These amounts are again a
            tuple of the form (top, right, bottom, left), with each value being an integer.

        Returns
        -------
        segmap : imgaug.SegmentationMapOnImage
            Padded segmentation map as SegmentationMapOnImage object.

        pad_amounts : tuple of int
            Amounts by which the segmentation map was padded on each side, given as a
            tuple ``(top, right, bottom, left)``.
            This tuple is only returned if `return_pad_amounts` was set to True.

        """
        arg_5, arg_6 = ia.Func(arg_0.arr, arg_1=arg_1, arg_2=arg_2, arg_3=arg_3,
                                                         arg_4=True)
        arg_7 = SegmentationMapOnImage(arg_5, shape=arg_0.shape)
        arg_7.input_was = arg_0.input_was
        if arg_4:
            return arg_7, arg_6
        else:
            return arg_7


def Func(arg_0, arg_1, arg_2="cubic"):
        """
        Resize the segmentation map array to the provided size given the provided interpolation.

        Parameters
        ----------
        sizes : float or iterable of int or iterable of float
            New size of the array in ``(height, width)``.
            See :func:`imgaug.imgaug.imFunc_single_image` for details.

        interpolation : None or str or int, optional
            The interpolation to use during Func.
            See :func:`imgaug.imgaug.imFunc_single_image` for details.
            Note: The segmentation map is internally stored as multiple float-based heatmaps,
            making smooth interpolations potentially more reasonable than nearest neighbour
            interpolation.

        Returns
        -------
        segmap : imgaug.SegmentationMapOnImage
            Resized segmentation map object.

        """
        arg_3 = ia.imFunc_single_image(arg_0.arr, arg_1, arg_2=arg_2)

        # cubic interpolation can lead to values outside of [0.0, 1.0],
        # see https://github.com/opencv/opencv/issues/7195
        # TODO area interpolation too?
        arg_3 = np.clip(arg_3, 0.0, 1.0)
        arg_4 = SegmentationMapOnImage(arg_3, shape=arg_0.shape)
        arg_4.input_was = arg_0.input_was
        return arg_4


def Func(arg_0, arg_1, arg_2: arg_3):
        """
        Offer a new event ``s`` at point ``p`` in this queue.
        """
        arg_4 = arg_0.events_scan.setdefault(
                arg_1, ([], [], [], []) if USE_VERTICAL else
                   ([], [], []))
        # Can use double linked-list for easy insertion at beginning/end
        '''
        if e.type == Event.Type.END:
            existing.insert(0, e)
        else:
            existing.append(e)
        '''

        arg_4[arg_2.type].append(arg_2)


def Func(arg_0, arg_1=None, arg_2="jet"):
        """
        Render the heatmaps as RGB images.

        Parameters
        ----------
        size : None or float or iterable of int or iterable of float, optional
            Size of the rendered RGB image as ``(height, width)``.
            See :func:`imgaug.imgaug.imresize_single_image` for details.
            If set to None, no resizing is performed and the size of the heatmaps array is used.

        cmap : str or None, optional
            Color map of ``matplotlib`` to use in order to convert the heatmaps to RGB images.
            If set to None, no color map will be used and the heatmaps will be converted
            to simple intensity maps.

        Returns
        -------
        heatmaps_Funcn : list of (H,W,3) ndarray
            Rendered heatmaps. One per heatmap array channel. Dtype is uint8.

        """
        arg_3 = arg_0.to_uint8()
        arg_4 = []

        for arg_5 in sm.xrange(arg_3.shape[2]):
            # c:c+1 here, because the additional axis is needed by imresize_single_image
            arg_6 = arg_3[..., arg_5:arg_5+1]

            if arg_1 is not None:
                arg_7 = ia.imresize_single_image(arg_6, arg_1, interpolation="nearest")
            else:
                arg_7 = arg_6
            arg_7 = np.squeeze(arg_7).astype(np.float32) / 255.0

            if arg_2 is not None:
                # import only when necessary (faster startup; optional dependency; less fragile -- see issue #225)
                import matplotlib.pyplot as plt

                arg_8 = plt.get_cmap(arg_2)
                arg_9 = arg_8(arg_7)
                arg_9 = np.delete(arg_9, 3, 2)
            else:
                arg_9 = np.tile(arg_7[..., np.newaxis], (1, 1, 3))

            arg_9 = np.clip(arg_9 * 255, 0, 255).astype(np.uint8)

            arg_4.append(arg_9)
        return arg_4


def Func(arg_0, arg_1, arg_2=0.75, arg_3="jet", arg_4="heatmaps"):
        """
        Draw the heatmaps as overlays over an image.

        Parameters
        ----------
        image : (H,W,3) ndarray
            Image onto which to draw the heatmaps. Expected to be of dtype uint8.

        alpha : float, optional
            Alpha/opacity value to use for the mixing of image and heatmaps.
            Higher values mean that the heatmaps will be more visible and the image less visible.

        cmap : str or None, optional
            Color map to use. See :func:`imgaug.HeatmapsOnImage.draw` for details.

        resize : {'heatmaps', 'image'}, optional
            In case of size differences between the image and heatmaps, either the image or
            the heatmaps can be resized. This parameter controls which of the two will be resized
            to the other's size.

        Returns
        -------
        mix : list of (H,W,3) ndarray
            Rendered overlays. One per heatmap array channel. Dtype is uint8.

        """
        # assert RGB image
        ia.do_assert(arg_1.ndim == 3)
        ia.do_assert(arg_1.shape[2] == 3)
        ia.do_assert(arg_1.dtype.type == np.uint8)

        ia.do_assert(0 - 1e-8 <= arg_2 <= 1.0 + 1e-8)
        ia.do_assert(arg_4 in ["heatmaps", "image"])

        if arg_4 == "image":
            arg_1 = ia.imresize_single_image(arg_1, arg_0.arr_0to1.shape[0:2], interpolation="cubic")

        arg_5 = arg_0.draw(
            size=arg_1.shape[0:2] if arg_4 == "heatmaps" else None,
            arg_3=arg_3
        )

        arg_6 = [
            np.clip((1-arg_2) * arg_1 + arg_2 * heatmap_i, 0, 255).astype(np.uint8)
            for heatmap_i
            in arg_5
        ]

        return arg_6


def Func(arg_0, arg_1, arg_2="constant", arg_3=0.0, arg_4=False):
        """
        Pad the heatmaps on their sides so that they match a target aspect ratio.

        Depending on which dimension is smaller (height or width), only the corresponding
        sides (left/right or top/bottom) will be padded. In each case, both of the sides will
        be padded equally.

        Parameters
        ----------
        aspect_ratio : float
            Target aspect ratio, given as width/height. E.g. 2.0 denotes the image having twice
            as much width as height.

        mode : str, optional
            Padding mode to use. See :func:`numpy.pad` for details.

        cval : number, optional
            Value to use for padding if `mode` is ``constant``. See :func:`numpy.pad` for details.

        return_pad_amounts : bool, optional
            If False, then only the padded image will be returned. If True, a tuple with two
            entries will be returned, where the first entry is the padded image and the second
            entry are the amounts by which each image side was padded. These amounts are again a
            tuple of the form (top, right, bottom, left), with each value being an integer.

        Returns
        -------
        heatmaps : imgaug.HeatmapsOnImage
            Padded heatmaps as HeatmapsOnImage object.

        pad_amounts : tuple of int
            Amounts by which the heatmaps were padded on each side, given as a tuple ``(top, right, bottom, left)``.
            This tuple is only returned if `return_pad_amounts` was set to True.

        """
        arg_5, arg_6 = ia.Func(arg_0.arr_0to1, arg_1=arg_1, arg_2=arg_2,
                                                              arg_3=arg_3, arg_4=True)
        arg_7 = HeatmapsOnImage.from_0to1(arg_5, shape=arg_0.shape, min_value=arg_0.min_value,
                                             max_value=arg_0.max_value)
        if arg_4:
            return arg_7, arg_6
        else:
            return arg_7


def Func(arg_0, arg_1, arg_2=0.0, arg_3=1.0):
        """
        Create a heatmaps object from an heatmap array containing values ranging from 0.0 to 1.0.

        Parameters
        ----------
        arr_0to1 : (H,W) or (H,W,C) ndarray
            Heatmap(s) array, where ``H`` is height, ``W`` is width and ``C`` is the number of heatmap channels.
            Expected dtype is float32.

        shape : tuple of ints
            Shape of the image on which the heatmap(s) is/are placed. NOT the shape of the
            heatmap(s) array, unless it is identical to the image shape (note the likely
            difference between the arrays in the number of channels).
            If there is not a corresponding image, use the shape of the heatmaps array.

        min_value : float, optional
            Minimum value for the heatmaps that the 0-to-1 array represents. This will usually
            be 0.0. It is used when calling :func:`imgaug.HeatmapsOnImage.get_arr`, which converts the
            underlying ``(0.0, 1.0)`` array to value range ``(min_value, max_value)``.
            E.g. if you started with heatmaps in the range ``(-1.0, 1.0)`` and projected these
            to (0.0, 1.0), you should call this function with ``min_value=-1.0``, ``max_value=1.0``
            so that :func:`imgaug.HeatmapsOnImage.get_arr` returns heatmap arrays having value
            range (-1.0, 1.0).

        max_value : float, optional
            Maximum value for the heatmaps that to 0-to-255 array represents.
            See parameter min_value for details.

        Returns
        -------
        heatmaps : imgaug.HeatmapsOnImage
            Heatmaps object.

        """
        arg_4 = HeatmapsOnImage(arg_0, arg_1, arg_2=0.0, arg_3=1.0)
        arg_4.min_value = arg_2
        arg_4.max_value = arg_3
        return arg_4


def Func(arg_0):
        """
        Create a deep copy of the Heatmaps object.

        Returns
        -------
        imgaug.HeatmapsOnImage
            Deep copy.

        """
        return HeatmapsOnImage(arg_0.get_arr(), shape=arg_0.shape, min_value=arg_0.min_value, max_value=arg_0.max_value)


def Func(arg_0):
    """Convert a ``PIL Image`` or ``numpy.ndarray`` to tensor.

    See ``ToTensor`` for more details.

    Args:
        pic (PIL Image or numpy.ndarray): Image to be converted to tensor.

    Returns:
        Tensor: Converted image.
    """
    if not(_is_pil_image(arg_0) or _is_numpy_image(arg_0)):
        raise TypeError('pic should be PIL Image or ndarray. Got {}'.format(type(arg_0)))

    if isinstance(arg_0, np.ndarray):
        # handle numpy array
        if arg_0.ndim == 2:
            arg_0 = arg_0[:, :, None]

        arg_1 = torch.from_numpy(arg_0.transpose((2, 0, 1)))
        # backward compatibility
        if isinstance(arg_1, torch.ByteTensor):
            return arg_1.float().div(255)
        else:
            return arg_1

    if accimage is not None and isinstance(arg_0, accimage.Image):
        arg_2 = np.zeros([arg_0.channels, arg_0.height, arg_0.width], dtype=np.float32)
        arg_0.copyto(arg_2)
        return torch.from_numpy(arg_2)

    # handle PIL Image
    if arg_0.mode == 'I':
        arg_1 = torch.from_numpy(np.array(arg_0, np.int32, copy=False))
    elif arg_0.mode == 'I;16':
        arg_1 = torch.from_numpy(np.array(arg_0, np.int16, copy=False))
    elif arg_0.mode == 'F':
        arg_1 = torch.from_numpy(np.array(arg_0, np.float32, copy=False))
    elif arg_0.mode == '1':
        arg_1 = 255 * torch.from_numpy(np.array(arg_0, np.uint8, copy=False))
    else:
        arg_1 = torch.ByteTensor(torch.ByteStorage.from_buffer(arg_0.tobytes()))
    # PIL image mode: L, LA, P, I, F, RGB, YCbCr, RGBA, CMYK
    if arg_0.mode == 'YCbCr':
        arg_3 = 3
    elif arg_0.mode == 'I;16':
        arg_3 = 1
    else:
        arg_3 = len(arg_0.mode)
    arg_1 = arg_1.view(arg_0.size[1], arg_0.size[0], arg_3)
    # put it from HWC to CHW format
    # yikes, this transpose takes 80% of the loading time/CPU
    arg_1 = arg_1.transpose(0, 1).transpose(0, 2).contiguous()
    if isinstance(arg_1, torch.ByteTensor):
        return arg_1.float().div(255)
    else:
        return arg_1


def Func(arg_0, arg_1, arg_2, arg_3=False):
    """Normalize a tensor image with mean and standard deviation.

    .. note::
        This transform acts out of place by default, i.e., it does not mutates the input tensor.

    See :class:`~torchvision.transforms.Normalize` for more details.

    Args:
        tensor (Tensor): Tensor image of size (C, H, W) to be Funcd.
        mean (sequence): Sequence of means for each channel.
        std (sequence): Sequence of standard deviations for each channel.

    Returns:
        Tensor: Normalized Tensor image.
    """
    if not _is_tensor_image(arg_0):
        raise TypeError('tensor is not a torch image.')

    if not arg_3:
        arg_0 = arg_0.clone()

    arg_1 = torch.as_tensor(arg_1, dtype=torch.float32, device=arg_0.device)
    arg_2 = torch.as_tensor(arg_2, dtype=torch.float32, device=arg_0.device)
    arg_0.sub_(arg_1[:, None, None]).div_(arg_2[:, None, None])
    return arg_0


def Func(arg_0, arg_1, arg_2=arg_3.BILINEAR):
    r"""Resize the input PIL Image to the given size.

    Args:
        img (PIL Image): Image to be Funcd.
        size (sequence or int): Desired output size. If size is a sequence like
            (h, w), the output size will be matched to this. If size is an int,
            the smaller edge of the image will be matched to this number maintaing
            the aspect ratio. i.e, if height > width, then image will be rescaled to
            :math:`\left(\text{size} \times \frac{\text{height}}{\text{width}}, \text{size}\right)`
        interpolation (int, optional): Desired interpolation. Default is
            ``PIL.Image.BILINEAR``

    Returns:
        PIL Image: Resized image.
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))
    if not (isinstance(arg_1, int) or (isinstance(arg_1, Iterable) and len(arg_1) == 2)):
        raise TypeError('Got inappropriate size arg: {}'.format(arg_1))

    if isinstance(arg_1, int):
        arg_5, arg_6 = arg_0.size
        if (arg_5 <= arg_6 and arg_5 == arg_1) or (arg_6 <= arg_5 and arg_6 == arg_1):
            return arg_0
        if arg_5 < arg_6:
            arg_7 = arg_1
            arg_8 = int(arg_1 * arg_6 / arg_5)
            return arg_0.Func((arg_7, arg_8), arg_2)
        else:
            arg_8 = arg_1
            arg_7 = int(arg_1 * arg_5 / arg_6)
            return arg_0.Func((arg_7, arg_8), arg_2)
    else:
        return arg_0.Func(arg_1[::-1], arg_2)


def Func(arg_0, arg_1, arg_2=0, arg_3='constant'):
    r"""Pad the given PIL Image on all sides with specified Funcding mode and fill value.

    Args:
        img (PIL Image): Image to be Funcded.
        Funcding (int or tuple): Padding on each border. If a single int is provided this
            is used to Func all borders. If tuple of length 2 is provided this is the Funcding
            on left/right and top/bottom respectively. If a tuple of length 4 is provided
            this is the Funcding for the left, top, right and bottom borders
            respectively.
        fill: Pixel fill value for constant fill. Default is 0. If a tuple of
            length 3, it is used to fill R, G, B channels respectively.
            This value is only used when the Funcding_mode is constant
        Funcding_mode: Type of Funcding. Should be: constant, edge, reflect or symmetric. Default is constant.

            - constant: Funcs with a constant value, this value is specified with fill

            - edge: Funcs with the last value on the edge of the image

            - reflect: Funcs with reflection of image (without repeating the last value on the edge)

                       Funcding [1, 2, 3, 4] with 2 elements on both sides in reflect mode
                       will result in [3, 2, 1, 2, 3, 4, 3, 2]

            - symmetric: Funcs with reflection of image (repeating the last value on the edge)

                         Funcding [1, 2, 3, 4] with 2 elements on both sides in symmetric mode
                         will result in [2, 1, 1, 2, 3, 4, 4, 3]

    Returns:
        PIL Image: Padded image.
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    if not isinstance(arg_1, (numbers.Number, tuple)):
        raise TypeError('Got inappropriate Funcding arg')
    if not isinstance(arg_2, (numbers.Number, str, tuple)):
        raise TypeError('Got inappropriate fill arg')
    if not isinstance(arg_3, str):
        raise TypeError('Got inappropriate Funcding_mode arg')

    if isinstance(arg_1, Sequence) and len(arg_1) not in [2, 4]:
        raise ValueError("Padding must be an int or a 2, or 4 element tuple, not a " +
                         "{} element tuple".format(len(arg_1)))

    assert arg_3 in ['constant', 'edge', 'reflect', 'symmetric'], \
        'Padding mode should be either constant, edge, reflect or symmetric'

    if arg_3 == 'constant':
        if arg_0.mode == 'P':
            arg_4 = arg_0.getpalette()
            arg_5 = ImageOps.expand(arg_0, border=arg_1, arg_2=arg_2)
            arg_5.putpalette(arg_4)
            return arg_5

        return ImageOps.expand(arg_0, border=arg_1, arg_2=arg_2)
    else:
        if isinstance(arg_1, int):
            arg_6 = arg_8 = arg_7 = arg_9 = arg_1
        if isinstance(arg_1, Sequence) and len(arg_1) == 2:
            arg_6 = arg_8 = arg_1[0]
            arg_7 = arg_9 = arg_1[1]
        if isinstance(arg_1, Sequence) and len(arg_1) == 4:
            arg_6 = arg_1[0]
            arg_7 = arg_1[1]
            arg_8 = arg_1[2]
            arg_9 = arg_1[3]

        if arg_0.mode == 'P':
            arg_4 = arg_0.getpalette()
            arg_0 = np.asarray(arg_0)
            arg_0 = np.Func(arg_0, ((arg_7, arg_9), (arg_6, arg_8)), arg_3)
            arg_0 = Image.fromarray(arg_0)
            arg_0.putpalette(arg_4)
            return arg_0

        arg_0 = np.asarray(arg_0)
        # RGB image
        if len(arg_0.shape) == 3:
            arg_0 = np.Func(arg_0, ((arg_7, arg_9), (arg_6, arg_8), (0, 0)), arg_3)
        # Grayscale image
        if len(arg_0.shape) == 2:
            arg_0 = np.Func(arg_0, ((arg_7, arg_9), (arg_6, arg_8)), arg_3)

        return Image.fromarray(arg_0)


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """Crop the given PIL Image.

    Args:
        img (PIL Image): Image to be Funcped.
        i (int): i in (i,j) i.e coordinates of the upper left corner.
        j (int): j in (i,j) i.e coordinates of the upper left corner.
        h (int): Height of the Funcped image.
        w (int): Width of the Funcped image.

    Returns:
        PIL Image: Cropped image.
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    return arg_0.Func((arg_2, arg_1, arg_2 + arg_4, arg_1 + arg_3))


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6=arg_7.BILINEAR):
    """Crop the given PIL Image and resize it to desired size.

    Notably used in :class:`~torchvision.transforms.RandomResizedCrop`.

    Args:
        img (PIL Image): Image to be cropped.
        i (int): i in (i,j) i.e coordinates of the upper left corner
        j (int): j in (i,j) i.e coordinates of the upper left corner
        h (int): Height of the cropped image.
        w (int): Width of the cropped image.
        size (sequence or int): Desired output size. Same semantics as ``resize``.
        interpolation (int, optional): Desired interpolation. Default is
            ``PIL.Image.BILINEAR``.
    Returns:
        PIL Image: Cropped image.
    """
    assert _is_pil_image(arg_0), 'img should be PIL Image'
    arg_0 = crop(arg_0, arg_1, arg_2, arg_3, arg_4)
    arg_0 = resize(arg_0, arg_5, arg_6)
    return arg_0


def Func(arg_0):
    """Horizontally flip the given PIL Image.

    Args:
        img (PIL Image): Image to be flipped.

    Returns:
        PIL Image:  Horizontall flipped image.
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    return arg_0.transpose(Image.FLIP_LEFT_RIGHT)


def Func(arg_0, arg_1, arg_2, arg_3=arg_4.BICUBIC):
    """Perform Func transform of the given PIL Image.

    Args:
        img (PIL Image): Image to be transformed.
        coeffs (tuple) : 8-tuple (a, b, c, d, e, f, g, h) which contains the coefficients.
                            for a Func transform.
        interpolation: Default- Image.BICUBIC
    Returns:
        PIL Image:  Perspectively transformed Image.
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    arg_6 = _get_Func_coeffs(arg_1, arg_2)
    return arg_0.transform(arg_0.size, arg_4.PERSPECTIVE, arg_6, arg_3)


def Func(arg_0):
    """Vertically flip the given PIL Image.

    Args:
        img (PIL Image): Image to be flipped.

    Returns:
        PIL Image:  Vertically flipped image.
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    return arg_0.transpose(Image.FLIP_TOP_BOTTOM)


def Func(arg_0, arg_1):
    """Crop the given PIL Image into four corners and the central crop.

    .. Note::
        This transform returns a tuple of images and there may be a
        mismatch in the number of inputs and targets your ``Dataset`` returns.

    Args:
       size (sequence or int): Desired output size of the crop. If size is an
           int instead of sequence like (h, w), a square crop (size, size) is
           made.

    Returns:
       tuple: tuple (tl, tr, bl, br, center)
                Corresponding top left, top right, bottom left, bottom right and center crop.
    """
    if isinstance(arg_1, numbers.Number):
        arg_1 = (int(arg_1), int(arg_1))
    else:
        assert len(arg_1) == 2, "Please provide only two dimensions (h, w) for size."

    arg_2, arg_3 = arg_0.size
    arg_4, arg_5 = arg_1
    if arg_5 > arg_2 or arg_4 > arg_3:
        raise ValueError("Requested crop size {} is bigger than input size {}".format(arg_1,
                                                                                (arg_3, arg_2)))
    arg_6 = arg_0.crop((0, 0, arg_5, arg_4))
    arg_7 = arg_0.crop((arg_2 - arg_5, 0, arg_2, arg_4))
    arg_8 = arg_0.crop((0, arg_3 - arg_4, arg_5, arg_3))
    arg_9 = arg_0.crop((arg_2 - arg_5, arg_3 - arg_4, arg_2, arg_3))
    arg_10 = center_crop(arg_0, (arg_4, arg_5))
    return (arg_6, arg_7, arg_8, arg_9, arg_10)


def Func(arg_0, arg_1):
    """Adjust brightness of an Image.

    Args:
        img (PIL Image): PIL Image to be adjusted.
        brightness_factor (float):  How much to adjust the brightness. Can be
            any non negative number. 0 gives a black image, 1 gives the
            original image while 2 increases the brightness by a factor of 2.

    Returns:
        PIL Image: Brightness adjusted image.
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    arg_2 = ImageEnhance.Brightness(arg_0)
    arg_0 = arg_2.enhance(arg_1)
    return arg_0


def Func(arg_0, arg_1, arg_2=False, arg_3=False, arg_4=None):
    """Rotate the image by angle.

    Args:
        img (PIL Image): PIL Image to be Funcd.
        angle (float or int): In degrees degrees counter clockwise order.
        resample (``PIL.Image.NEAREST`` or ``PIL.Image.BILINEAR`` or ``PIL.Image.BICUBIC``, optional):
            An optional resampling filter. See `filters`_ for more information.
            If omitted, or if the image has mode "1" or "P", it is set to ``PIL.Image.NEAREST``.
        expand (bool, optional): Optional expansion flag.
            If true, expands the output image to make it large enough to hold the entire Funcd image.
            If false or omitted, make the output image the same size as the input image.
            Note that the expand flag assumes rotation around the center and no translation.
        center (2-tuple, optional): Optional center of rotation.
            Origin is the upper left corner.
            Default is the center of the image.

    .. _filters: https://pillow.readthedocs.io/en/latest/handbook/concepts.html#filters

    """

    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    return arg_0.Func(arg_1, arg_2, arg_3, arg_4)


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=0, arg_6=None):
    """Apply Func transformation on the image keeping image center invariant

    Args:
        img (PIL Image): PIL Image to be rotated.
        angle (float or int): rotation angle in degrees between -180 and 180, clockwise direction.
        translate (list or tuple of integers): horizontal and vertical translations (post-rotation translation)
        scale (float): overall scale
        shear (float): shear angle value in degrees between -180 to 180, clockwise direction.
        resample (``PIL.Image.NEAREST`` or ``PIL.Image.BILINEAR`` or ``PIL.Image.BICUBIC``, optional):
            An optional resampling filter.
            See `filters`_ for more information.
            If omitted, or if the image has mode "1" or "P", it is set to ``PIL.Image.NEAREST``.
        fillcolor (int): Optional fill color for the area outside the transform in the output image. (Pillow>=5.0.0)
    """
    if not _is_pil_image(arg_0):
        raise TypeError('img should be PIL Image. Got {}'.format(type(arg_0)))

    assert isinstance(arg_2, (tuple, list)) and len(arg_2) == 2, \
        "Argument translate should be a list or tuple of length 2"

    assert arg_3 > 0.0, "Argument scale should be positive"

    arg_7 = arg_0.size
    arg_8 = (arg_0.size[0] * 0.5 + 0.5, arg_0.size[1] * 0.5 + 0.5)
    arg_9 = _get_inverse_Func_matrix(arg_8, arg_1, arg_2, arg_3, arg_4)
    arg_10 = {"fillcolor": arg_6} if PILLOW_VERSION[0] == '5' else {}
    return arg_0.transform(arg_7, Image.AFFINE, arg_9, arg_5, **arg_10)


def Func(arg_0, arg_1):
        """
        Finds the class folders in a dataset.

        Args:
            dir (string): Root directory path.

        Returns:
            tuple: (classes, class_to_idx) where classes are relative to (dir), and class_to_idx is a dictionary.

        Ensures:
            No class is a subdirectory of another.
        """
        if sys.version_info >= (3, 5):
            # Faster and available in Python 3.5 and above
            arg_2 = [d.name for d in os.scandir(arg_1) if d.is_dir()]
        else:
            arg_2 = [d for d in os.listdir(arg_1) if os.path.isdir(os.path.join(arg_1, d))]
        arg_2.sort()
        arg_3 = {arg_2[i]: i for i in range(len(arg_2))}
        return arg_2, arg_3


def Func(arg_0, arg_1):
    """Return a Tensor containing the list of labels
       Read the file and keep only the ID of the 3D point.
    """
    arg_2 = []
    with open(os.path.join(arg_0, arg_1), 'r') as f:
        arg_2 = [int(line.split()[0]) for line in f]
    return torch.LongTensor(arg_2)


def Func(arg_0, arg_1, arg_2=(1,)):
    """Computes the Func over the k top predictions for the specified values of k"""
    with torch.no_grad():
        arg_3 = max(arg_2)
        arg_4 = arg_1.size(0)

        arg_5, arg_6 = arg_0.topk(arg_3, 1, True, True)
        arg_6 = arg_6.t()
        arg_7 = arg_6.eq(arg_1[None])

        arg_8 = []
        for arg_9 in arg_2:
            arg_10 = arg_7[:arg_9].flatten().sum(dtype=torch.float32)
            arg_8.append(arg_10 * (100.0 / arg_4))
        return arg_8


def Func(arg_0):
    """
    This function disables printing when not in master process
    """
    import builtins as arg_5
    arg_1 = arg_5.print

    def arg_6(*arg_2, **arg_3):
        arg_4 = arg_3.pop('force', False)
        if arg_0 or arg_4:
            arg_1(*arg_2, **arg_3)

    arg_5.print = arg_6


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
    """Download a file from a url and place it in root.

    Args:
        url (str): URL to download file from
        root (str): Directory to place downloaded file in
        filename (str, optional): Name to save the file under. If None, use the basename of the URL
        md5 (str, optional): MD5 checksum of the download. If None, do not check
    """
    from six.moves import urllib

    arg_1 = os.path.expanduser(arg_1)
    if not arg_2:
        arg_2 = os.path.basename(arg_0)
    arg_4 = os.path.join(arg_1, arg_2)

    makedir_exist_ok(arg_1)

    # downloads file
    if os.path.isfile(arg_4) and check_integrity(arg_4, arg_3):
        print('Using downloaded and verified file: ' + arg_4)
    else:
        try:
            print('Downloading ' + arg_0 + ' to ' + arg_4)
            urllib.request.urlretrieve(
                arg_0, arg_4,
                reporthook=gen_bar_updater()
            )
        except OSError:
            if arg_0[:5] == 'https':
                arg_0 = arg_0.replace('https:', 'http:')
                print('Failed download. Trying https -> http instead.'
                      ' Downloading ' + arg_0 + ' to ' + arg_4)
                urllib.request.urlretrieve(
                    arg_0, arg_4,
                    reporthook=gen_bar_updater()
                )


def Func(arg_0, arg_1=False):
    """List all directories at a given root

    Args:
        root (str): Path to directory whose folders need to be listed
        prefix (bool, optional): If true, prepends the path to each result, otherwise
            only returns the name of the directories found
    """
    arg_0 = os.path.expanduser(arg_0)
    arg_2 = list(
        filter(
            lambda p: os.path.isdir(os.path.join(arg_0, p)),
            os.listdir(arg_0)
        )
    )

    if arg_1 is True:
        arg_2 = [os.path.join(arg_0, d) for d in arg_2]

    return arg_2


def Func(arg_0, arg_1, arg_2=False):
    """List all files ending with a suffix at a given root

    Args:
        root (str): Path to directory whose folders need to be listed
        suffix (str or tuple): Suffix of the files to match, e.g. '.png' or ('.jpg', '.png').
            It uses the Python "str.endswith" method and is passed directly
        prefix (bool, optional): If true, prepends the path to each result, otherwise
            only returns the name of the files found
    """
    arg_0 = os.path.expanduser(arg_0)
    arg_3 = list(
        filter(
            lambda p: os.path.isfile(os.path.join(arg_0, p)) and p.endswith(arg_1),
            os.listdir(arg_0)
        )
    )

    if arg_2 is True:
        arg_3 = [os.path.join(arg_0, d) for d in arg_3]

    return arg_3


def Func(arg_0, arg_1):
        """Get parameters for ``crop`` for a random crop.

        Args:
            img (PIL Image): Image to be cropped.
            output_size (tuple): Expected output size of the crop.

        Returns:
            tuple: params (i, j, h, w) to be passed to ``crop`` for random crop.
        """
        arg_2, arg_3 = arg_0.size
        arg_4, arg_5 = arg_1
        if arg_2 == arg_5 and arg_3 == arg_4:
            return 0, 0, arg_3, arg_2

        arg_6 = random.randint(0, arg_3 - arg_4)
        arg_7 = random.randint(0, arg_2 - arg_5)
        return arg_6, arg_7, arg_4, arg_5


def Func(arg_0, arg_1, arg_2):
        """Get parameters for ``perspective`` for a random perspective transform.

        Args:
            width : width of the image.
            height : height of the image.

        Returns:
            List containing [top-left, top-right, bottom-right, bottom-left] of the orignal image,
            List containing [top-left, top-right, bottom-right, bottom-left] of the transformed image.
        """
        arg_3 = int(arg_1 / 2)
        arg_4 = int(arg_0 / 2)
        arg_5 = (random.randint(0, int(arg_2 * arg_4)),
                   random.randint(0, int(arg_2 * arg_3)))
        arg_6 = (random.randint(arg_0 - int(arg_2 * arg_4) - 1, arg_0 - 1),
                    random.randint(0, int(arg_2 * arg_3)))
        arg_7 = (random.randint(arg_0 - int(arg_2 * arg_4) - 1, arg_0 - 1),
                    random.randint(arg_1 - int(arg_2 * arg_3) - 1, arg_1 - 1))
        arg_8 = (random.randint(0, int(arg_2 * arg_4)),
                   random.randint(arg_1 - int(arg_2 * arg_3) - 1, arg_1 - 1))
        arg_9 = [(0, 0), (arg_0 - 1, 0), (arg_0 - 1, arg_1 - 1), (0, arg_1 - 1)]
        arg_10 = [arg_5, arg_6, arg_7, arg_8]
        return arg_9, arg_10


def Func(arg_0, arg_1, arg_2):
        """Get parameters for ``crop`` for a random sized crop.

        Args:
            img (PIL Image): Image to be cropped.
            scale (tuple): range of size of the origin size cropped
            ratio (tuple): range of aspect ratio of the origin aspect ratio cropped

        Returns:
            tuple: params (i, j, h, w) to be passed to ``crop`` for a random
                sized crop.
        """
        arg_3 = arg_0.size[0] * arg_0.size[1]

        for arg_4 in range(10):
            arg_5 = random.uniform(*arg_1) * arg_3
            arg_6 = (math.log(arg_2[0]), math.log(arg_2[1]))
            arg_7 = math.exp(random.uniform(*arg_6))

            arg_8 = int(round(math.sqrt(arg_5 * arg_7)))
            arg_9 = int(round(math.sqrt(arg_5 / arg_7)))

            if arg_8 <= arg_0.size[0] and arg_9 <= arg_0.size[1]:
                arg_10 = random.randint(0, arg_0.size[1] - arg_9)
                arg_11 = random.randint(0, arg_0.size[0] - arg_8)
                return arg_10, arg_11, arg_9, arg_8

        # Fallback to central crop
        arg_12 = arg_0.size[0] / arg_0.size[1]
        if (arg_12 < min(arg_2)):
            arg_8 = arg_0.size[0]
            arg_9 = arg_8 / min(arg_2)
        elif (arg_12 > max(arg_2)):
            arg_9 = arg_0.size[1]
            arg_8 = arg_9 * max(arg_2)
        else:  # whole image
            arg_8 = arg_0.size[0]
            arg_9 = arg_0.size[1]
        arg_10 = (arg_0.size[1] - arg_9) // 2
        arg_11 = (arg_0.size[0] - arg_8) // 2
        return arg_10, arg_11, arg_9, arg_8


def Func(arg_0, arg_1, arg_2, arg_3):
        """Get a randomized transform to be applied on image.

        Arguments are same as that of __init__.

        Returns:
            Transform which randomly adjusts brightness, contrast and
            saturation in a random order.
        """
        arg_4 = []

        if arg_0 is not None:
            arg_5 = random.uniform(arg_0[0], arg_0[1])
            arg_4.append(Lambda(lambda img: F.adjust_brightness(img, arg_5)))

        if arg_1 is not None:
            arg_6 = random.uniform(arg_1[0], arg_1[1])
            arg_4.append(Lambda(lambda img: F.adjust_contrast(img, arg_6)))

        if arg_2 is not None:
            arg_7 = random.uniform(arg_2[0], arg_2[1])
            arg_4.append(Lambda(lambda img: F.adjust_saturation(img, arg_7)))

        if arg_3 is not None:
            arg_8 = random.uniform(arg_3[0], arg_3[1])
            arg_4.append(Lambda(lambda img: F.adjust_hue(img, arg_8)))

        random.shuffle(arg_4)
        arg_9 = Compose(arg_4)

        return arg_9


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """Get parameters for affine transformation

        Returns:
            sequence: params to be passed to the affine transformation
        """
        arg_5 = random.uniform(arg_0[0], arg_0[1])
        if arg_1 is not None:
            arg_6 = arg_1[0] * arg_4[0]
            arg_7 = arg_1[1] * arg_4[1]
            arg_8 = (np.round(random.uniform(-arg_6, arg_6)),
                            np.round(random.uniform(-arg_7, arg_7)))
        else:
            arg_8 = (0, 0)

        if arg_2 is not None:
            arg_9 = random.uniform(arg_2[0], arg_2[1])
        else:
            arg_9 = 1.0

        if arg_3 is not None:
            arg_10 = random.uniform(arg_3[0], arg_3[1])
        else:
            arg_10 = 0.0

        return arg_5, arg_8, arg_9, arg_10


def Func(arg_0):
        """Download the MNIST data if it doesn't exist in processed_folder already."""

        if arg_0._check_exists():
            return

        makedir_exist_ok(arg_0.raw_folder)
        makedir_exist_ok(arg_0.processed_folder)

        # Func files
        for arg_1 in arg_0.urls:
            arg_2 = arg_1.rpartition('/')[2]
            arg_3 = os.path.join(arg_0.raw_folder, arg_2)
            Func_url(arg_1, root=arg_0.raw_folder, arg_2=arg_2, md5=None)
            arg_0.extract_gzip(gzip_path=arg_3, remove_finished=True)

        # process and save as torch files
        print('Processing...')

        arg_4 = (
            read_image_file(os.path.join(arg_0.raw_folder, 'train-images-idx3-ubyte')),
            read_label_file(os.path.join(arg_0.raw_folder, 'train-labels-idx1-ubyte'))
        )
        arg_5 = (
            read_image_file(os.path.join(arg_0.raw_folder, 't10k-images-idx3-ubyte')),
            read_label_file(os.path.join(arg_0.raw_folder, 't10k-labels-idx1-ubyte'))
        )
        with open(os.path.join(arg_0.processed_folder, arg_0.training_file), 'wb') as f:
            torch.save(arg_4, f)
        with open(os.path.join(arg_0.processed_folder, arg_0.test_file), 'wb') as f:
            torch.save(arg_5, f)

        print('Done!')


def Func(arg_0=None):
    """Returns theme name.

    Checks in this order:
    1. override
    2. cookies
    3. settings"""

    if arg_0 and (arg_0 in themes or arg_0 == '__common__'):
        return arg_0
    arg_1 = request.args.get('theme', request.preferences.get_value('theme'))
    if arg_1 not in themes:
        arg_1 = default_theme
    return arg_1


def Func():
    """Return Func results"""

    # set blocked engines
    arg_0 = request.preferences.engines.get_disabled()

    # parse query
    if PY3:
        arg_1 = RawTextQuery(request.form.get('q', b''), arg_0)
    else:
        arg_1 = RawTextQuery(request.form.get('q', u'').encode('utf-8'), arg_0)
    arg_1.parse_query()

    # check if search query is set
    if not arg_1.getSearchQuery():
        return '', 400

    # run Func
    arg_2 = autocomplete_backends.get(request.preferences.get_value('autocomplete'))

    # parse searx specific Func results like !bang
    arg_3 = searx_bang(arg_1)

    # normal autocompletion results only appear if max 3 inner results returned
    if len(arg_3) <= 3 and arg_2:
        # get language from cookie
        arg_4 = request.preferences.get_value('language')
        if not arg_4 or arg_4 == 'all':
            arg_4 = 'en'
        else:
            arg_4 = arg_4.split('-')[0]
        # run autocompletion
        arg_3.extend(arg_2(arg_1.getSearchQuery(), arg_4))

    # parse results (write :language and !engine back to result string)
    arg_5 = []
    for arg_6 in arg_3:
        arg_1.changeSearchQuery(arg_6)

        # add parsed result
        arg_5.append(arg_1.getFullQuery())

    # return Func results
    if request.form.get('format') == 'x-suggestions':
        return Response(json.dumps([arg_1.query, arg_5]),
                        mimetype='application/json')

    return Response(json.dumps(arg_5),
                    mimetype='application/json')


def Func():
    """Render Func page && save user Func"""

    # save Func
    if request.method == 'POST':
        arg_0 = make_response(redirect(urljoin(settings['server']['base_url'], url_for('index'))))
        try:
            request.Func.parse_form(request.form)
        except ValidationException:
            request.errors.append(gettext('Invalid settings, please edit your Func'))
            return arg_0
        return request.Func.save(arg_0)

    # render Func
    arg_1 = request.Func.get_value('image_proxy')
    arg_2 = request.Func.get_value('language')
    arg_3 = request.Func.engines.get_disabled()
    arg_4 = request.Func.plugins.get_enabled()

    # stats for Func page
    arg_5 = {}

    for arg_6 in categories:
        for arg_7 in categories[arg_6]:
            arg_5[arg_7.name] = {'time': None,
                             'warn_timeout': False,
                             'warn_time': False}
            if arg_7.timeout > settings['outgoing']['request_timeout']:
                arg_5[arg_7.name]['warn_timeout'] = True
            arg_5[arg_7.name]['supports_selected_language'] = _is_selected_language_supported(arg_7, request.Func)

    # get first element [0], the engine time,
    # and then the second element [1] : the time (the first one is the label)
    for arg_9 in get_engines_stats()[0][1]:
        arg_5[arg_9.get('name')]['time'] = round(arg_9.get('avg'), 3)
        if arg_9.get('avg') > settings['outgoing']['request_timeout']:
            arg_5[arg_9.get('name')]['warn_time'] = True
    # end of stats

    return render('Func.html',
                  locales=settings['locales'],
                  current_locale=get_locale(),
                  arg_1=arg_1,
                  engines_by_category=categories,
                  arg_5=arg_5,
                  answerers=[{'info': arg_11.self_info(), 'keywords': arg_11.keywords} for arg_11 in answerers],
                  arg_3=arg_3,
                  autocomplete_backends=autocomplete_backends,
                  shortcuts={arg_13: arg_12 for arg_12, arg_13 in engine_shortcuts.items()},
                  themes=themes,
                  plugins=plugins,
                  doi_resolvers=settings['doi_resolvers'],
                  current_doi_resolver=get_doi_resolver(request.args, request.Func.get_value('doi_resolver')),
                  arg_4=arg_4,
                  theme=get_current_theme_name(),
                  Func_url_params=request.Func.get_as_url_params(),
                  base_url=get_base_url(),
                  Func=True)


def Func(arg_0):
    '''check if the searchQuery contain a bang, and create fitting autocompleter results'''
    # check if there is a query which can be parsed
    if len(arg_0.getSearchQuery()) == 0:
        return []

    arg_1 = []

    # check if current query stats with !bang
    arg_2 = arg_0.getSearchQuery()[0]
    if arg_2 == '!' or arg_2 == '?':
        if len(arg_0.getSearchQuery()) == 1:
            # show some example queries
            # TODO, check if engine is not avaliable
            arg_1.append(arg_2 + "images")
            arg_1.append(arg_2 + "wikipedia")
            arg_1.append(arg_2 + "osm")
        else:
            arg_3 = arg_0.getSearchQuery()[1:]

            # check if query starts with categorie name
            for arg_4 in categories:
                if arg_4.startswith(arg_3):
                    arg_1.append(arg_2 + '{categorie}'.format(arg_4=arg_4))

            # check if query starts with engine name
            for arg_5 in engines:
                if arg_5.startswith(arg_3.replace('_', ' ')):
                    arg_1.append(arg_2 + '{engine}'.format(arg_5=arg_5.replace(' ', '_')))

            # check if query starts with engine shortcut
            for arg_6 in engine_shortcuts:
                if arg_6.startswith(arg_3):
                    arg_1.append(arg_2 + '{engine_shortcut}'.format(arg_6=arg_6))

    # check if current query stats with :bang
    elif arg_2 == ':':
        if len(arg_0.getSearchQuery()) == 1:
            # show some example queries
            arg_1.append(":en")
            arg_1.append(":en_us")
            arg_1.append(":english")
            arg_1.append(":united_kingdom")
        else:
            arg_3 = arg_0.getSearchQuery()[1:]

            for arg_7 in language_codes:
                arg_8, arg_9, arg_10, arg_11 = map(unicode.lower, arg_7)

                # check if query starts with language-id
                if arg_8.startswith(arg_3):
                    if len(arg_3) <= 2:
                        arg_1.append(u':{lang_id}'.format(arg_8=arg_8.split('-')[0]))
                    else:
                        arg_1.append(u':{lang_id}'.format(arg_8=arg_8))

                # check if query starts with language name
                if arg_9.startswith(arg_3) or arg_11.startswith(arg_3):
                    arg_1.append(u':{lang_name}'.format(arg_9=arg_9))

                # check if query starts with country
                if arg_10.startswith(arg_3.replace('_', ' ')):
                    arg_1.append(u':{country}'.format(arg_10=arg_10.replace(' ', '_')))

    # remove duplicates
    arg_12 = set(arg_1)

    # remove results which are already contained in the query
    for arg_13 in arg_0.query_parts:
        if arg_13 in arg_12:
            arg_12.remove(arg_13)

    # convert result_set back to list
    return list(arg_12)


def Func(
    arg_0, arg_1,
    arg_2, arg_3, arg_4):
  """Eight-schools joint log-prob."""
  arg_5 = tfd.Normal(loc=0., scale=10.)
  arg_6 = tfd.Normal(loc=5., scale=1.)
  arg_7 = mvn(
      loc=tf.zeros_like(arg_4),
      scale=tf.ones_like(arg_4))
  arg_8 = mvn(
      loc=(arg_2 + tf.exp(arg_3) * arg_4),
      scale=arg_1)
  return (
      arg_5.log_prob(arg_2) +
      arg_6.log_prob(arg_3) +
      arg_7.log_prob(arg_4) +
      arg_8.log_prob(arg_0))


def Func(
    arg_0=arg_1(5e3),
    arg_2=arg_1(3e3),
    arg_3=3,
    arg_4=0.4):
  """Runs HMC on the eight-schools unnormalized posterior."""

  arg_5 = 8
  arg_6 = tf.constant(
      [28, 8, -3, 7, -1, 1, 18, 12],
      dtype=np.float32,
      name='treatment_effects')
  arg_7 = tf.constant(
      [15, 10, 16, 11, 9, 11, 10, 18],
      dtype=np.float32,
      name='treatment_stddevs')

  def unnormalized_posterior_log_prob(
      arg_8, arg_9, arg_10):
    """Eight-schools unnormalized log posterior."""
    return eight_schools_joint_log_prob(
        arg_6, arg_7,
        arg_8, arg_9, arg_10)

  if tf.executing_eagerly():
    arg_11 = tf.function(tfp.mcmc.sample_chain)
  else:
    arg_11 = tfp.mcmc.sample_chain

  def computation():
    """The benchmark computation."""
    arg_12, arg_13 = arg_11(
        arg_0=arg_0,
        arg_2=arg_2,
        current_state=(
            tf.zeros([], name='init_avg_effect'),
            tf.zeros([], name='init_avg_stddev'),
            tf.ones([arg_5], name='init_school_effects_standard'),
        ),
        kernel=tfp.mcmc.HamiltonianMonteCarlo(
            target_log_prob_fn=unnormalized_posterior_log_prob,
            arg_4=arg_4,
            arg_3=arg_3))

    return arg_13.is_accepted

  # Let's force evaluation of graph to ensure build time is not part of our time
  # trial.
  arg_14 = computation()
  if not tf.executing_eagerly():
    arg_15 = tf.compat.v1.Session()
    arg_15.run(arg_14)

  arg_16 = time.time()
  if tf.executing_eagerly():
    arg_17 = computation()
  else:
    arg_17 = arg_15.run(arg_14)
  arg_18 = time.time() - arg_16

  arg_19 = np.sum(arg_17)
  arg_20 = np.float32(arg_19) / np.float32(arg_0)

  return dict(
      iters=(arg_0 + arg_2) * arg_3,
      extras={'acceptance_rate': arg_20},
      arg_18=arg_18)