Fix wrong error messages with torch.nn.AdaptiveMaxPool1d (#107450)
Fixes #104822
A duplicate check is introduced into function `adaptive_max_pool1d`, but this is probably a relatively good approach.
Of course, it is also possible to transparently pass a flag in function `adaptive_max_pool1d` to function `adaptive_max_pool2d`(no need to add new parameter), and then supplement relevant Checks in `adaptive_max_pool2d`, but this approach is not clear enough first, and secondly, the amount of modification is relatively large.
At the same time, there is currently a duplicate check for `output_size`,which is cheched in both functions(`adaptive_max_pool1d` && `adaptive_max_pool2d`)
If you have better advice, please let me know, thank you
Pull Request resolved: https://github.com/pytorch/pytorch/pull/107450
Approved by: https://github.com/ezyang