Replace endswith calls in a loop with a single endswith call (#832)
Replace endswith calls in a loop with a single endswith call (#832)

str.endswith can take a single string, or a tuple of strings. This replaces a loop over each extension and a call to endswith with a single call to endswith passing in all the allowed extensions. This has the advantage that the loop over each extension is done in c rather than python, and the code is a little less verbose.
pytorch/vision,pytorch/vision,pytorch/vision,pytorch/vision,pytorch/vision,pytorch/vision