index = T.iscalar()
train_function = theano.function(inputs = [index], outputs = [cost_function], updates = updates,
givens = {
x: train_set[0][index * batch_size: (index + 1) * batch_size],
y: train_set[1][index * batch_size: (index + 1) * batch_size]
})
I am trying to follow a theano tutorial and trying to implement my own version of logistic regression. I have created a function that takes an integer input as an input and trains the model. train_set[0] is the entire matrix data, train_set[1] is the entire label data
X and Y are subsets of matrix and label data respectively
Since I am training batch wise, I need to remove batch samples from my data which I do using the index variable.
However I get the following error at this line of code
TypeError: slice indices must be integers or None or have an __index__ method
I have also tried
index = lscalar()
Any suggestions ?
Figured it out. Had to convert train_set[0] and test_set[0] into a theano array variable