The right approach is to push the tensors to the CPU before trying to call plt.plot on them.
It’s unclear what raises the last error, since it seems you are trying to call .cpu() on the model output, which is not using two different tensors which might create the device mismatch (so I guess the error is raised in another line of code).