aesara.tensor.ogrid

Contents

aesara.tensor.ogrid#

aesara.tensor.ogrid = <aesara.tensor.basic._nd_grid object>[source]#

Create a dense n-dimensional ‘meshgrid’ with equally spaced points.

Used to create the instance mgrid and ogrid which act similarly to their numpy equivalents.

Parameters:

sparse (boolean, optional, default=True) – Specifying False leads to the equivalent of numpy’s mgrid functionality. Specifying True leads to the equivalent of ogrid.

Examples

>>> a = at.mgrid[0:5, 0:3]
>>> a[0].eval()
array([[0, 0, 0],
       [1, 1, 1],
       [2, 2, 2],
       [3, 3, 3],
       [4, 4, 4]], dtype=int8)
>>> a[1].eval()
array([[0, 1, 2],
       [0, 1, 2],
       [0, 1, 2],
       [0, 1, 2],
       [0, 1, 2]], dtype=int8)
>>> b = at.ogrid[0:5, 0:3]
>>> b[0].eval()
array([[0],
       [1],
       [2],
       [3],
       [4]], dtype=int8)
>>> b[1].eval()
array([[0, 1, 2, 3]], dtype=int8)