c = torch.cat([a, b]) calculates the value of c every time you run it. This is a feature.
As a general rule, you shouldn’t modify a.data because any change to a.data is not stored in the computation graph and won’t be differentiated when backpropagating.