is_numpy_scalar should also consider bool and complex types (#43644)
Summary:
Before this PR,
```python
import torch
import numpy as np
a = torch.tensor([1, 2], dtype=torch.bool)
c = np.array([1, 2], dtype=np.bool)
print(a[0] == c[0])
a = torch.tensor([1, 2], dtype=torch.complex64)
c = np.array([1, 2], dtype=np.complex64)
print(a[0] == c[0])
# This case is still broken
a = torch.tensor([1 + 1j, 2 + 2j], dtype=torch.complex64)
c = np.array([1 + 1j, 2 + 2j], dtype=np.complex64)
print(a[0] == c[0])
```
outputs
```
False
False
False
```
After this PR, it outputs:
```
tensor(True)
/home/user/src/pytorch/torch/tensor.py:25: ComplexWarning: Casting complex values to real discards the imaginary part return f(*args, **kwargs)
tensor(True)
tensor(False)
```
Related issue: https://github.com/pytorch/pytorch/issues/43579
cc anjali411 mruberry
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43644
Reviewed By: ailzhang
Differential Revision: D23425569
Pulled By: anjali411
fbshipit-source-id: a868209376b30cea601295e54015c47803923054