Since you are assigning the result to the same tensor, it’s considered an inplace operation.
You could instead create a new result tensor, using torch.cat and slicing:
input = torch.ones(2)
linear = nn.Linear(2, 2)
output = linear(input)
output1 = nn.ReLU(inplace=False)(output[0])
output = torch.cat((output1.unsqueeze(0), output[1:]))
loss = torch.sum(output)
loss.backward()