🚀 The feature, motivation and pitch
OP: #110351 (comment)
As an example, it would be nice to have torch.sqrt(python scalar) -> python scalar without having to dispatch between torch.sqrt and math.sqrt and to enable a bit more polymorphic code
Another idea is to also have torch.pi and other constants (like NumPy), in order to avoid importing numpy or math in order to get these constants.
Please close this if it's duplicate. I tried to search for similar previous discussions, but the keywords are a bit too generic :(
For torch.sqrt specifically, the polymorphic equivalent currently exists: x ** 0.5 which works both for tensor and python scalar inputs. But it is useful to have this behavior for many (at least simple) functions like torch.exp and so forth
Alternatives
No response
Additional context
No response
cc @mruberry @rgommers @albanD