I'm trying to get a better grasp of the scan functionality in theano, my understanding is that it behaves like a for loop based on this document. I've created a very simple working example to find the weight and bias when performing linear…
I would like to know how to add each element in two vectors with Theano?
Assume that we have two vector vector_1 and vecotr_2, and we would like to construct a matrix A, where
A[i][j] = vector_1[i] + vecotr_2[j]
I know that in numpy we can use…
I have taken the following code from http://deeplearning.net/software/theano/library/scan.html
import numpy
coefficients = theano.tensor.vector("coefficients")
x = T.scalar("x")
max_coefficients_supported = 10000
# Generate…
I am trying to implement Probabilistic Matrix Factorization with Stochastic Gradient Descent updates, in theano, without using a for loop.
I have just started learning the basics of theano; unfortunately on my experiment I get this…
I have a strange error that I don't manage to understand when compiling a scan operator in Theano.
When outputs_info is initialized with a last dimension equal to one, I get this error:
TypeError: ('The following error happened while compiling the…
In the Theano Tutorial:
http://deeplearning.net/software/theano/tutorial/gradients.html
or
>>> import theano
>>> import theano.tensor as T
>>> x = T.dvector('x')
>>> y = x ** 2
>>> J, updates = theano.scan(lambda i, y,x : T.grad(y[i], x),…
I'm getting the following error when I try to run my LSTM program (for variable length inputs).
TypeError: Inconsistency in the inner graph of scan 'scan_fn' : an
input and an output are associated with the same recurrent state and
should…
I have a model in which rates of a random (Poisson) process are distributed according to a function p_nu(gamma,delta,nu_max). With pymc3/theano I want to obtain the posterior distribution of gamma,delta,nu_max when observing N_AP events (N_AP being…
I want to transform a P vector of n elements into a Z vector of n+1 elements using the following formula:
I was able to do that in python with:
import numpy as np
def p_to_Z(p):
k = len(p)
Z = np.zeros(k+1)
Z[0] = p[0]
Z[1:k] =…
I would like to to use theano.scan within pymc3. I run into problems when I add more than two variables as sequences. Here is a simple example:
import numpy as np
import pymc3 as pm
import theano
import theano.tensor as T
a = np.ones(5)
b =…
I have a matrix and 3D tensor defined as below :
import numpy as np
import theano
import theano.tensor as T
a = T.matrix('a', dtype='float32')
c = T.tensor3('c',dtype='float32')
d = T.batched_dot(c, a)
g = theano.function([a,c],d)
Y = [[[1, 0, 0,…
Win 10 x64, conda, theano 0.9, python 3.6.1, spyder 3.1.4, IPython 6.0.0
When I test the code in scan api tutorial Iterating over the first dimension of a tensor: Calculating a polynomial , i.e.
import theano
import numpy as np
import theano.tensor…
I am trying to extract the decisions of an RNN for all tokens in a sequence but receive the error mentioned at the end of the post.
Any help will be appreciated!
Code:
# gated recurrent unit
def gru_step(x, h_prev, W_xm, W_hm, W_xh, W_hh):
m =…
I have a list :
my_list = [[1,2,3,4], [4,5,6], [1,2,1,2,1,2]]
I also have a tensor variable:
a_tensor = theano.tensor.ivector("tensor")
now I want to use theano.scan to get the corresponding item in the list given the index:
result, _ =…
This is my code in theano
max_max=200
beReplaced=T.matrix()
toReplace=T.matrix()
timeArray=T.arange(max_max)
def f(v,k,w):
return T.concatenate([w[:k],v,w[k+1:]],axis=0)
result,_=theano.scan(f,
…