tensor.utils
– Tensor Utils¶
-
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.
Parameters: - fgraph – The theano.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 theano >>> x = theano.tensor.matrix('x') >>> y = x[512:]; y.name = 'y' >>> fgraph = theano.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))