Hey, I write a model to generate sequential images. My model looks like this:

  netV's input is noise and hidden state,  its output is an image, the next hidden state and next noise.

I use a loop to to use netV to generate many images,which look like this:
 images = []
 for i in range( 8 ):
      image, noise_next, hidden_next = netV(noise, hidden)
      noise = noise_next
      hidden = hidden_next
      images.append(image)  
  
  The forward is ok. However, I'm not sure can the backwark works. Can the grad backward normally? I don't know how the grad flows in the backward