def test_dearrayify(): from numpy import array assert dearrayify(3) == 3 assert dearrayify(array(3)) == 3 assert dearrayify((3, array(4))) == (3, 4) assert dearrayify((3, 4)) == (3, 4) assert dearrayify({'x': (array(1000), array(1000)), 'y': (), 'z': 5}) == \ {'x': (1000, 1000), 'y': (), 'z': 5}
def shape_of_variables(i, o, input_shapes): fgraph = theano.FunctionGraph(i, o) known_shapes = dearrayify( theano.tensor.utils.shape_of_variables(fgraph, input_shapes)) fgraph.disown() return known_shapes