Previous topic

downsample – Down-Sampling

Next topic

tensor.extra_ops – Tensor Extra Ops

This Page

tensor.utils – Tensor Utils

theano.tensor.utils.hash_from_dict(d)

Work around the fact that dict are not hashable in python

This request that all object have a sorted order that depend only on the value of the object. This is true for integer/float/string

We do not verify that the objects in the dict have this property.

Also, we transform values that are list into tuple as list are not hashable.

theano.tensor.utils.hash_from_ndarray(data)

Return a hash from an ndarray

It takes care of the data, shapes, strides and dtype.

theano.tensor.utils.shape_of_variables(fgraph, input_shapes)

Compute the numeric shape of all intermediate variables given input shapes

Inputs:
fgraph - the theano.FunctionGraph in question input_shapes - a dict mapping input to shape
Outputs:
shapes - a dict mapping variable to shape

WARNING : This modifies the fgraph. Not pure.

>>> import theano
>>> x = theano.tensor.matrix('x')
>>> y = x[512:]; y.name = 'y'
>>> fgraph = theano.FunctionGraph([x], [y])
>>> shape_of_variables(fgraph, {x: (1024, 1024)})
{y: (512, 1024), x: (1024, 1024)}