Tensor utils#
- aesara.tensor.utils.as_list(x)[source]#
Convert x to a list if it is an iterable; otherwise, wrap it in a list.
- aesara.tensor.utils.hash_from_ndarray(data)[source]#
Return a hash from an ndarray.
It takes care of the data, shapes, strides and dtype.
- aesara.tensor.utils.shape_of_variables(fgraph, input_shapes)[source]#
Compute the numeric shape of all intermediate variables given input shapes.
- Parameters:
fgraph – The FunctionGraph in question.
input_shapes (dict) – A dict mapping input to shape.
- Returns:
shapes (dict) – A dict mapping variable to shape
.. warning:: This modifies the fgraph. Not pure.
Examples
>>> import aesara >>> x = aesara.tensor.matrix('x') >>> y = x[512:]; y.name = 'y' >>> fgraph = FunctionGraph([x], [y], clone=False) >>> d = shape_of_variables(fgraph, {x: (1024, 1024)}) >>> d[y] (array(512), array(1024)) >>> d[x] (array(1024), array(1024))