I have the following code that adds 2 matrices to a three-dimensional tensor.
import theano import theano.tensor as T A = T.matrix("A") B = theano.tensor.stack(A, A) f = theano.function(inputs=[A], outputs=B) print f([range(10)]*2)
However, I do not know how many times I need to add the matrix in advance. For example, the fourth line of code could be:
B = theano.tensor.stack(A, A, A) B = theano.tensor.stack(A, A, A, A) etc...
Is there an anano function to duplicate a matrix n times:
theano.some_function(A, 3) = theano.tensor.stack(A, A, A)
Then I can pass this 3 as an argument to the anano f function. Is it possible? I watched the broadcast, but the broadcast does not explicitly change the dimension / stack.
source share