I observed in PyTorch’s source code some functions that follow the pattern below (for example this one):
def my_function(a, b, c, d=None, e=None): if not torch.jit.is_scripting(): tens_ops = (a, b, c) if any([type(t) is not Tensor for t in tens_ops]) and has_torch_function(tens_ops): return handle_torch_function(my_function , a, b, c, d=d, e=e) # something else here
Could anybody please tell me what’s going on there? In particular, what do
And more importantly: Where can I learn those things in detail so that I can myself write similar custom functions and stop asking stupid questions like these? It seems that these are about TorchScript, but I wanted to ask just in case, before diving into that.
Thank you very much in advance for your help!