Add theano.len to compute a Variable's symbolic length
The idea would be to make e.g. getting the length of a vector look better than calling vector.shaperevision:0, and more importantly, being able to get the length of non tensor-like variables (e.g. a String Variable).
James suggested that theano.len(v) means v.type.symbolic_len(v), so types that implement symbolic_len work with theano.len.
An explicit error should be thrown if theano.len is called on something that is not a Variable (in case someone accidently uses it instead of the builtin len).
See also discussion thread: http://groups.google.com/group/theano-dev/t/e8721a5753964fd7
James suggested that theano.len(v) means v.type.symbolic_len(v), so types that implement symbolic_len work with theano.len.
An explicit error should be thrown if theano.len is called on something that is not a Variable (in case someone accidently uses it instead of the builtin len).
See also discussion thread: http://groups.google.com/group/theano-dev/t/e8721a5753964fd7
Leave a comment