Solved by SimonW in post #4 
              
              
                Here you seem to work outside the Variable interface. If generated_vectors is generated using tensors and/or numpy, then no history will be tracked. So pytorch cannot backward pass it.