Why default_included_set include BackendSelect and ADInplaceOrView?

Hi, team. I am confused about default_included_set, why we need this?
// See Note [TLS Initialization]
constexpr DispatchKeySet default_included_set = DispatchKeySet({

What is your question about this?

The BackendSelect is there because it needs to be triggered for functions with no Tensor input.

ADInplaceOrView is here because it also needs to always trigger whatever the state of the calling Tensors.

1 Like

Thank you a lot, I’m reading some code related to dispatch key set and there are some parts I don’t quite understand. Do you have any recommended documentation?

The best document is Let’s talk about the PyTorch dispatcher : ezyang’s blog even though it is a bit old. Some of the things have changed but that is the best high level intro for sure.