Torch.nn.functional API and Declarations.yaml

I am using Declarations.yaml to generate bindings for the torch API. One thing I’m a little confused by is that several operations seem to be specified in Declarations.yaml without default, but present in torch.nn.functional with defaults. For example, poisson_nll_loss has defaults here, but in Declarations.yaml, the schema string is aten::poisson_nll_loss(Tensor input, Tensor target, bool log_input, bool full, float eps, int reduction) -> Tensor.

Is there a reason for this? Is there some subtle difference between the call in torch.nn.functional and the underlying op?

The torch.nn.functional is a Python module that has no “automatic” equivalent in C++.
That said, I don’t think there is a systematic reason native_functions.yaml (the origin for these) doesn’t declare default values but rather historical reasons, especially for not-as-often used functions that originate from torch7 (e.g. other loss functions do have defaults).
If you are adventurous, you could try to provide a PR providing the defaults matching the Python API and see what people say.

Best regards


Thanks for the quick response!

I put up a PR.