One might add that if input is an input to your function, the correct way is to leave it const Tensor& and declare a new local variable as
auto cont_input = input.contiguous();
This is assuming that your function won’t actually try to change input (which it should not when you call contiguous()…
Best regards
Thomas