The first approach will create a leaf tensor which requires gradient while the second one returns a non-leaf tensor, as the view operation is performed on the leaf tensor and thus its .grad attribute won’t be populated by default.