__builtins__ has nothing to do with torch; it’s the special Python name for the quasi-module containing the language’s builtin functions, and all modules have it as an attribute.
The any function is a Python built-in, not a torch function, but there is probably a way to achieve the same thing on a torch tensor.