Inconsistency in Data Type Requirements for torch.max and torch.mul Functions

I’ve come across an interesting observation regarding the data type requirements for the torch.max and torch.mul functions. According to the documentation, when using torch.max(a, out=(b, c)), it is explicitly stated that the data types of the output tensors b and a must be the same.

However, I noticed that when using torch.mul(a, 3, out=b), there is no strict requirement for the data types of b and a to be identical. I’m curious about the rationale behind this difference in behavior.

Could someone point me to the specific files or modules where this logic is implemented? I guess the relevant codes are in TensorIterator.cpp. Any guidance on navigating the PyTorch source code to find this information would be greatly appreciated.