[resolved] Runtime error assigning hidden state
I am using a GRUCell at each time-step to pass input and hidden state and get back the new hidden state in the following way: <SCODE>hidden_states[i, j, :] = GRUCell(input, hidden_states[i, j, :])
<ECODE> where <SCODE>hidden_states = Variable(torch.zeros(N, N, 1, hidden_state_size)).cuda()
<ECODE> As you can notice that instead of sending a batch of inputs, I am sending one input at a time (hence, the 1 in the tensor size). When I run this, I get a runtime error as follows: <SCODE>RuntimeError: in-place operations can be only used on variables that don't share storage with any other variables, but detected that there are 2 objects sharing it
<ECODE> Can anyone explain how I have created another variable with the same storage as hidden_states?
vvanirudh
Resolved. I was using hidden_states elsewhere in the code and creating a new variable that shared the storage.
vvanirudh