def __init__(self, n_dims_before, dims_neighbourhoods, strides=None, ignore_border=False, inverse=False):
    '\n        This extracts neighbourhoods from "images", but in a\n        dimension-generic manner.\n\n        In the 2D case, this is similar to downsampling, but instead of reducing\n        a group of 2x2 pixels (for example) to a single new pixel in the output,\n        you place those 4 pixels in a row.\n\n        For example, say you have this 2x4 image::\n\n            [ [ 0.5, 0.6, 0.7, 0.8 ],\n              [ 0.1, 0.2, 0.3, 0.4 ] ]\n\n        and you want to extract 2x2 neighbourhoods. This op would then produce::\n\n            [ [ [ 0.5, 0.6, 0.1, 0.2 ] ], # the first 2x2 group of pixels\n              [ [ 0.7, 0.8, 0.3, 0.4 ] ] ] # the second one\n\n        so think of a 2D downsampling where each pixel of the resulting array\n        is replaced by an array containing the (flattened) pixels of the\n        corresponding neighbourhood.\n\n        If you provide a stack of 2D image, or multiple stacks, each image\n        will be treated independently, and the first dimensions of the array\n        will be preserved as such.\n\n        This also makes sense in the 1D or 3D case. Below I\'ll still be calling\n        those "images", by analogy.\n\n        In the 1D case, you\'re\n        extracting subsequences from the original sequence. In the 3D case,\n        you\'re extracting cuboids. If you ever find a 4D use, tell me! It\n        should be possible, anyhow.\n\n        Parameters\n        ----------\n        n_dims_before : int\n            Number of dimensions preceding the "images".\n        dims_neighbourhoods : tuple of ints\n            Exact shape of windows to be extracted (e.g. (2,2) in the case above).\n            n_dims_before + len(dims_neighbourhoods) should be equal to the\n            number of dimensions in the input given to the op.\n        strides : tuple of int\n            Number of elements to skip when moving to the next neighbourhood,\n            for each dimension of dims_neighbourhoods. There can be overlap\n            between neighbourhoods, or gaps.\n        ignore_border : bool\n            If the dimensions of the neighbourhoods don\'t exactly divide the\n            dimensions of the "images", you can either fill the last\n            neighbourhood with zeros (False) or drop it entirely (True).\n        inverse : bool\n            You shouldn\'t have to use this. Only used by child class\n            ImagesFromNeighbourhoods which simply reverses the assignment.\n        '
    self.n_dims_before = n_dims_before
    self.dims_neighbourhoods = dims_neighbourhoods
    if (strides is not None):
        self.strides = strides
    else:
        self.strides = dims_neighbourhoods
    self.ignore_border = ignore_border
    self.inverse = inverse
    (self.code_string, self.code) = self.make_py_code()
This extracts neighbourhoods from "images", but in a
dimension-generic manner.

In the 2D case, this is similar to downsampling, but instead of reducing
a group of 2x2 pixels (for example) to a single new pixel in the output,
you place those 4 pixels in a row.

For example, say you have this 2x4 image::

    [ [ 0.5, 0.6, 0.7, 0.8 ],
      [ 0.1, 0.2, 0.3, 0.4 ] ]

and you want to extract 2x2 neighbourhoods. This op would then produce::

    [ [ [ 0.5, 0.6, 0.1, 0.2 ] ], # the first 2x2 group of pixels
      [ [ 0.7, 0.8, 0.3, 0.4 ] ] ] # the second one

so think of a 2D downsampling where each pixel of the resulting array
is replaced by an array containing the (flattened) pixels of the
corresponding neighbourhood.

If you provide a stack of 2D image, or multiple stacks, each image
will be treated independently, and the first dimensions of the array
will be preserved as such.

This also makes sense in the 1D or 3D case. Below I'll still be calling
those "images", by analogy.

In the 1D case, you're
extracting subsequences from the original sequence. In the 3D case,
you're extracting cuboids. If you ever find a 4D use, tell me! It
should be possible, anyhow.

Parameters
----------
n_dims_before : int
    Number of dimensions preceding the "images".
dims_neighbourhoods : tuple of ints
    Exact shape of windows to be extracted (e.g. (2,2) in the case above).
    n_dims_before + len(dims_neighbourhoods) should be equal to the
    number of dimensions in the input given to the op.
strides : tuple of int
    Number of elements to skip when moving to the next neighbourhood,
    for each dimension of dims_neighbourhoods. There can be overlap
    between neighbourhoods, or gaps.
ignore_border : bool
    If the dimensions of the neighbourhoods don't exactly divide the
    dimensions of the "images", you can either fill the last
    neighbourhood with zeros (False) or drop it entirely (True).
inverse : bool
    You shouldn't have to use this. Only used by child class
    ImagesFromNeighbourhoods which simply reverses the assignment.
def __init__(self, n_dims_before, dims_neighbourhoods, strides=None, ignore_border=False, inverse=False):
    '\n        This extracts neighbourhoods from "images", but in a\n        dimension-generic manner.\n\n        In the 2D case, this is similar to downsampling, but instead of reducing\n        a group of 2x2 pixels (for example) to a single new pixel in the output,\n        you place those 4 pixels in a row.\n\n        For example, say you have this 2x4 image::\n\n            [ [ 0.5, 0.6, 0.7, 0.8 ],\n              [ 0.1, 0.2, 0.3, 0.4 ] ]\n\n        and you want to extract 2x2 neighbourhoods. This op would then produce::\n\n            [ [ [ 0.5, 0.6, 0.1, 0.2 ] ], # the first 2x2 group of pixels\n              [ [ 0.7, 0.8, 0.3, 0.4 ] ] ] # the second one\n\n        so think of a 2D downsampling where each pixel of the resulting array\n        is replaced by an array containing the (flattened) pixels of the\n        corresponding neighbourhood.\n\n        If you provide a stack of 2D image, or multiple stacks, each image\n        will be treated independently, and the first dimensions of the array\n        will be preserved as such.\n\n        This also makes sense in the 1D or 3D case. Below I\'ll still be calling\n        those "images", by analogy.\n\n        In the 1D case, you\'re\n        extracting subsequences from the original sequence. In the 3D case,\n        you\'re extracting cuboids. If you ever find a 4D use, tell me! It\n        should be possible, anyhow.\n\n        Parameters\n        ----------\n        n_dims_before : int\n            Number of dimensions preceding the "images".\n        dims_neighbourhoods : tuple of ints\n            Exact shape of windows to be extracted (e.g. (2,2) in the case above).\n            n_dims_before + len(dims_neighbourhoods) should be equal to the\n            number of dimensions in the input given to the op.\n        strides : tuple of int\n            Number of elements to skip when moving to the next neighbourhood,\n            for each dimension of dims_neighbourhoods. There can be overlap\n            between neighbourhoods, or gaps.\n        ignore_border : bool\n            If the dimensions of the neighbourhoods don\'t exactly divide the\n            dimensions of the "images", you can either fill the last\n            neighbourhood with zeros (False) or drop it entirely (True).\n        inverse : bool\n            You shouldn\'t have to use this. Only used by child class\n            ImagesFromNeighbourhoods which simply reverses the assignment.\n        '
    self.n_dims_before = n_dims_before
    self.dims_neighbourhoods = dims_neighbourhoods
    if (strides is not None):
        self.strides = strides
    else:
        self.strides = dims_neighbourhoods
    self.ignore_border = ignore_border
    self.inverse = inverse
    (self.code_string, self.code) = self.make_py_code()