You can reshape it back when you’re done 
Or even better don’t reshape it inplace and just do something like:
x = XXXX

x_view = x.view(batch, 10, 10)
# fill the values corresponding to label idx with 1s
x_view.select(1, label_idx) = 1

# Now you can use x that was changed by the inplace op.