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:
hidden_states[i, j, :] = GRUCell(input, hidden_states[i, j, :])
hidden_states = Variable(torch.zeros(N, N, 1, hidden_state_size)).cuda()
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:
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
Can anyone explain how I have created another variable with the same storage as hidden_states?