Alexander Farley
2017-08-07 23:20:55 UTC
I would like to define a Theano operation taking this vector:
[1,2,3]
To this array:
[[1,2,3],
[1,3,2],
[2,3,1],
[2,1,3],
[3,1,2],
[3,2,1]]
The problem I'm having is that while I can get the correct result using
numpy operations and arrays, I'm having trouble converting to Theano
operations. In numpy, I get the correct result using itertools.permutations:
np.array(list(itertools.permutations(x)))
However, if I swap in a Theano vector X as the argument:
X = T.vector()
np.array(list(itertools.permutations(X)))
then I get an error:
ValueError: length is not known
I think what's happening is that X is symbolic so it can't be evaluated by
itertools.permutations. Is there a simple way to do this in Theano or do I
have to construct the set of permutations from lower-level operations?
[1,2,3]
To this array:
[[1,2,3],
[1,3,2],
[2,3,1],
[2,1,3],
[3,1,2],
[3,2,1]]
The problem I'm having is that while I can get the correct result using
numpy operations and arrays, I'm having trouble converting to Theano
operations. In numpy, I get the correct result using itertools.permutations:
np.array(list(itertools.permutations(x)))
However, if I swap in a Theano vector X as the argument:
X = T.vector()
np.array(list(itertools.permutations(X)))
then I get an error:
ValueError: length is not known
I think what's happening is that X is symbolic so it can't be evaluated by
itertools.permutations. Is there a simple way to do this in Theano or do I
have to construct the set of permutations from lower-level operations?
--
---
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
---
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.