Hi all. There's some really unintuitive/inconsistent behaviour with theano's scan and I'm wondering how I should work around it.
Take the following test, which I would expect to pass: import theano import theano.tensor as tt def test_scan_tuple_output(): x = tt.matrix() def mul_by_2_and_3(data): return (data*2, data*3) y, updates = theano.scan(mul_by_2_and_3, sequences=[x]) assert len(y)==2 assert len(updates)==0 def mul_by_2(data): return (data*2, ) y, updates = theano.scan(mul_by_2, sequences = [x]) assert len(y)==1 assert len(updates) == 0 if __name__ == '__main__': test_scan_tuple_output() It fails on It It fails on assert len(y)==1 with "TypeError: object of type 'TensorVariable' has no len()" because if scan detects a tuple of length-1, it just returns the data inside this tuple. This becomes annoying when trying to make a scannable function with variable return length, (one of which can be one). Is there a way I can make scan not totally change its behaviour when the tuple of returned arguments happens to have length 1? -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.