could you solve it?
i have the same problem, i want to do a multiprocess over a for loop, here is my forward code:
def forward(self,x):
    output,(self.h,self.c)=self.lstm(x,(self.h,self.c))
    i=0
    out=[]
    for batch_size in output.batch_sizes:
      out.append(self.linear(output.data[i:batch_size+i,:]))
      i=i+batch_size
      t=t+1
    outs=torch.cat(out)
    return outs```
(output is a PaquedSequence and self.lstm and self.linear are the respective nn.Modules)
i have tried differents ways but allways i receive the ```
RuntimeError: Cowardly refusing to serialize non-leaf tensor which requires_grad, since autograd does not support crossing process boundaries.  If you just want to transfer the data, call detach() on the tensor before serializing (e.g., putting it on the queue).

is it possible to do multiprocess over inputs that are non-leaf and requires grad?
thank you !