So this my code:
import theano
from theano import tensor
from theano import shared
from theano import function
import numpy as np
from PIL import Image
import PIL
import pylab
import os, os.path
from theano.tensor.nnet import conv2d
from theano.tensor.signal import pool
from theano.ifelse import ifelse
theano.config.floatX='float32'
class RNN(object):
def __init__(self, INPUT,input_units, output_units,
number_final_outputs,previous_time_frame_output,previous_cell_Input):
self.input=INPUT #Input
parameters/features
self.input_layer_units= input_units
#Number of Input units
self.output_layer_units=output_units #Number
of Output Units
self.number_final_outputs=number_final_outputs
self.h_t_1=previous_time_frame_output #Getting the previous time
frame output of the hidden layer
self.c_t_1= previous_cell_Input
#Getting the previous cell input
W_XH=(np.array(np.random.rand(self.input_layer_units,self.output_layer_units),
dtype=theano.config.floatX)) #Weights for
Connection from Previous Layer to Current Layer
self.W_XH=shared(value=W_XH,name='Weight of Previous Hidden Layer
to Current Hidden in RNN',borrow=True)
B_XH=(np.array(np.zeros(self.output_layer_units),
dtype=theano.config.floatX))
self.B_XH=shared(value=B_XH,name='Bias of Previous Hidden Layer to
Current Hidden in RNN', borrow=True)
#Initializing the Bias
Units
W_HH= (np.array(np.random.rand(self.output_layer_units,
self.output_layer_units), dtype=theano.config.floatX))
self.W_HH=shared(value=W_HH,name='Weight of Previous Time Frame of
the Hidden Layer to Current Time frame hidden layer in RNN',borrow=True)
B_HH=(np.array(np.zeros(self.output_layer_units),
dtype=theano.config.floatX))
self.B_HH=shared(value=B_HH,name='Bias of Previous Time Frame of
the Hidden Layer to Current Time frame hidden layer in RNN',
borrow=True)#Initializing the Bias Units
W_HF=(np.array(np.random.rand(self.output_layer_units,
self.number_final_outputs), dtype=theano.config.floatX))
self.W_HF=shared(value=W_HF,name='Weight of Hidden Layer to Final
Layer in RNN',borrow=True)
B_HF=(np.array(np.zeros(self.number_final_outputs),
dtype=theano.config.floatX))
self.B_HF=shared(value=B_HF,name='Bias of Hidden Layer to Final
Layer in RNN', borrow=True)
def step(u_t, h_tm1, c_t_1, W, B_1, W_in,B_2, W_out,B_3):
h= tensor.tanh(tensor.dot(u_t, W_in) + tensor.dot(h_tm1, W) +
B_1 + B_2)
I=tensor.nnet.sigmoid(h)
F=tensor.nnet.sigmoid(h)
O=tensor.nnet.sigmoid(h)
G=tensor.tanh(h)
c_t= (F*c_t_1) + (I*G) #Cell output
h_t= O*(tensor.tanh(c_t)) #Output of
Hidden Layer after passing through LSTM
y_t = tensor.softmax(tensor.dot(h_t, W_out) + B_3)
return h_t, c_t,y_t
[h,c_t,y], _ = theano.scan(step , sequences=self.input,
outputs_info=[self.h_t_1, self.c_t_1, None],
non_sequences=[self.W_HH,self.B_HH,self.W_XH,self.B_XH,self.W_HF,self.B_HF
])
self.RNN_Output=h
*I am getting this error:*
File "Deep_RL_7.py", line 439, in <module>
Deep_RL_Object_Optimization()
File "Deep_RL_7.py", line 364, in Deep_RL_Object_Optimization
Deep_RL_Output= Deep_RL_Main(x, y)
#Creating an instance for Deep_RL_Object_Tracking
File "Deep_RL_7.py", line 341, in __init__
Z=RNN_LSTM.RNN(self.O_vector_matrix,Number_of_Units_Fully_Connected[0],Number_of_Hidden_Units_RNN[0],Number_of_Units_RNN_Output_layer,
previous_time_frame_output_array, c_t_1)
File "/home/sunjeet/Final_Impleamentation/RNN_LSTM.py", line 77, in
__init__
non_sequences=[self.W_HH,self.B_HH,self.W_XH,self.B_XH,self.W_HF,self.B_HF
])
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/scan.py",
line 475, in scan
actual_slice = seq['input'][k - mintap]
IndexError: list index out of range
--
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.