@albanD You mean that(_version changing during the forward pass) hardly happens in the most situations right?
Actually I want to use something similar to tf.placeholder in my model for sake of performance issue. And slicing and indexing to change its values are messing up torch.Tensor._version.
reason for using placeholder even with pytorch
The problem I’m dealing with is seq2seq based language model but it deploys the random variables labeled to each tokens and their intermediate vector representations used for every timestep such that I cannot just run rnn with packed_sequence or anything similar to it.
Thus, I’m running it token by token but trying to run it with minibatches of examples (like batches of tokens by tokens).  So in my model.py looks sth like below
def __init__(self):
    #init placeholder
    self.predicted_tokens_placeholder = torch.zeros(batchsize, maxlen, vocabsize).to(device)
    ...

def forward(self, *args):
    ...
    #updating placeholder with predicted token
    ph = self.predicted_tokens_placeholder.clone()
    ph[:, tstep] = b_tokens_predicted
    
    other self.variables are used here similarly, requires grad=True,
    even without .clone() for carrying intermediate representations 
    #indexing self.variables like above example happens alot.
    #oops those are in-place ops --> autograd problem occurs
    
    return ph

And I found out (just today) to make autograd work correct, I need to avoid in-place operations. That is the reason I wonder about torch.Tensor._version stays intact during the forward pass in general.