If features from this calculation: features = enc(output) # no gradient does not require gradients, you should be fine using either approach.
This would be the use case, e.g. if you are using this features output as the target for a specific loss calculation.