There is quite a bit of fine print to this rough “they have the same effect”. For example:

even in no_grad-mode views will be tracked (and have requires_grad set if they are views of a tensor that has).
detach is a more versatile operation in that you can control what you want to not have gradients (e.g. if you want to train only the last (few) layer(s) for fine-tuning).