Repository: pytorch
Issue: ComplexHalf Coverage Tracker
Labels: feature,triaged,module: complex,module: half

### 🚀 The feature, motivation and pitch

There have been multiple requests and issues (see https://github.com/pytorch/pytorch/issues/71680) to have better operator support for `complex32`. Currently it is almost impossible to do anything with a `Tensor` of `complex32` dtype (even printing doesn't work).

All operators which support complex dtypes should ideally support `complex32`. Computation will occur in `complex64` similar to `Half` wherein computation occurs in `float`.

**NOTE** : Math op support will mostly be enabled only on CUDA

Following is the operator coverage:

Fundamental Ops (expected 1.12)
* [x] copy_ (to support casting to and from `complex32`) (PR: https://github.com/pytorch/pytorch/pull/73847)
* [x] print support (Ref: https://github.com/pytorch/pytorch/issues/50097)
* [ ] storage support https://github.com/pytorch/pytorch/issues/73502
* [x] type promotion

**NOTE**: List will be updated if supporting above list requires supporting another operator 

High-Priority Ops (based on user demand)
* [x] Support for fft module (expected 1.12)
    * [x] fft.fft
    * [x] fft.fft2
    * [x] fft.fftn
    * [x] fft.hfft
    * [x] fft.hfft2
    * [x] fft.hfftn
    * [x] fft.rfft
    * [x] fft.rfft2
    * [x] fft.rfftn
    * [x] fft.ifft
    * [x] fft.ifft2
    * [x] fft.ifftn
    * [x] fft.irfft
    * [x] fft.irfft2
    * [x] fft.irfftn
    * [x] fft.ihfft
    * [x] fft.ihfft2
    * [x] fft.ihfftn
* [ ] Support for stft (see #67324) (expected 1.12)
    * [x] fill_
    * [ ] pad
* [ ] Support for convolution (see also #71108)

High-Priority Ops (expected 1.12)
* [x] add
* [x] sub
* [x] mul
* [x] div
* [x] sum
* [ ] mean
* [ ] equal
* [x] imag
* [x] real
* [x] H
* [x] T
* [x] \_\_getitem\_\_
* [x] Support testing with OpInfo infra
    * [x] testing.make_tensor
    * [x] complex (required for make_tensor) (PR: https://github.com/pytorch/pytorch/pull/74667)

Tensor Creation Ops:
* [x] randn (supported, needs tests)
* [x] rand (supported, needs tests)
* [x] empty (supported, needs tests)
* [x] full (supported, needs tests)
* [x] ones (supported, needs tests)
* [x] zeros (supported, needs tests)
* [ ] linspace
* [ ] logspace
* [ ] arange
* [ ] eye

Remaining Operators which support complex type (generated from OpInfo)
* [ ] \_\_radd\_\_
* [ ] \_\_rdiv\_\_
* [ ] \_\_rmatmul\_\_
* [ ] \_\_rmul\_\_
* [ ] \_\_rpow\_\_
* [ ] \_\_rsub\_\_
* [ ] _masked.mean
* [ ] _masked.prod
* [ ] _masked.sum
* [ ] _masked.var
* [x] abs
* [ ] acos
* [ ] acosh
* [ ] addbmm
* [ ] addcdiv
* [ ] addcmul
* [ ] addmm
* [ ] addmv
* [ ] addr
* [ ] allclose
* [x] angle
* [ ] any
* [ ] argwhere
* [x] as_strided
* [x] asin
* [ ] asinh
* [x] atan
* [ ] atanh
* [x] atleast_1d
* [x] atleast_2d
* [x] atleast_3d
* [ ] baddbmm
* [x] bfloat16
* [x] block_diag
* [ ] bmm
* [x] bool
* [ ] broadcast_tensors
* [ ] broadcast_to
* [ ] byte
* [ ] cartesian_prod
* [x] cat
* [x] char
* [ ] cholesky
* [ ] cholesky_inverse
* [ ] cholesky_solve
* [x] chunk
* [x] clone
* [x] column_stack
* [ ] combinations
* [x] conj
* [x] conj_physical
* [x] contiguous
* [ ] corrcoef
* [ ] cos
* [x] cosh
* [ ] count_nonzero
* [ ] cov
* [ ] cross
* [ ] cumprod
* [ ] cumsum
* [ ] cumulative_trapezoid
* [x] diag
* [x] diag_embed
* [ ] diagflat
* [x] diagonal
* [ ] diff
* [ ] dist
* [ ] dot
* [x] double
* [x] dsplit
* [ ] dstack
* [ ] eig
* [ ] einsum
* [x] empty_like
* [ ] eq
* [x] exp
* [ ] expand
* [ ] expand_as
* [x] flatten
* [ ] flip
* [ ] fliplr
* [ ] flipud
* [x] float
* [ ] float_power
* [ ] full_like
* [ ] gather
* [ ] geqrf
* [ ] gradient
* [ ] half
* [x] hsplit
* [ ] hstack
* [ ] index_add
* [ ] index_copy
* [ ] index_fill
* [ ] index_put
* [ ] index_select
* [ ] inner
* [ ] int
* [ ] inverse
* [ ] isclose
* [x] isfinite
* [x] isinf
* [ ] isnan
* [x] isreal
* [ ] istft
* [ ] kron
* [ ] ldexp
* [ ] lerp
* linalg.cholesky (won't support)
* linalg.cholesky_ex (won't support)
* linalg.cond (won't support)
* linalg.cross (won't support)
* linalg.det (won't support)
* linalg.eig (won't support)
* linalg.eigh (won't support)
* linalg.eigvals (won't support)
* linalg.eigvalsh (won't support)
* linalg.householder_product (won't support)
* linalg.inv (won't support)
* linalg.inv_ex (won't support)
* linalg.lstsq (won't support)
* linalg.lu_factor (won't support)
* linalg.lu_factor_ex (won't support)
* linalg.matrix_norm (won't support)
* linalg.matrix_power (won't support)
* linalg.matrix_rank (won't support)
* linalg.multi_dot (won't support)
* linalg.norm (won't support)
* linalg.pinv (won't support)
* linalg.qr (won't support)
* linalg.slogdet (won't support)
* linalg.solve (won't support)
* linalg.solve_triangular (won't support)
* linalg.svd (won't support)
* linalg.svdvals (won't support)
* linalg.tensorinv (won't support)
* linalg.tensorsolve (won't support)
* linalg.vector_norm (won't support)
* [x] log
* [ ] log10
* [ ] log2
* [x] log_softmax
* [ ] logical_and
* [ ] logical_not
* [ ] logical_or
* [ ] logical_xor
* [x] long
* [ ] lu
* [ ] lu_solve
* [ ] lu_unpack
* [x] mH
* [x] mT
* [ ] masked_fill
* [ ] masked_scatter
* [ ] masked_select
* [ ] matmul
* [ ] matrix_exp
* [ ] meshgrid
* [ ] mm
* [x] movedim
* [ ] mv
* [x] narrow
* [ ] ne
* [x] neg
* [x] new_empty
* [x] new_full
* [x] new_ones
* [x] new_zeros
* [ ] nn.functional.feature_alpha_dropout
* [ ] nn.functional.linear
* [ ] nn.functional.normalize
* [ ] nn.functional.pad
* [ ] nn.functional.pairwise_distance
* [ ] nn.functional.pixel_shuffle
* [ ] nn.functional.pixel_unshuffle
* [ ] nn.functional.silu
* [ ] nn.functional.softmin
* [ ] nn.functional.softsign
* [ ] nn.functional.tanhshrink
* [ ] nn.functional.unfold
* [ ] nonzero
* [ ] norm
* [x] ones_like
* [ ] ormqr
* [ ] outer
* [x] permute
* [ ] pinverse
* [x] positive
* [ ] pow
* [x] prod
* [ ] put
* [ ] qr
* [x] rand_like
* [x] randn_like
* [x] ravel
* [ ] reciprocal
* [ ] renorm
* [ ] repeat
* [ ] repeat_interleave
* [x] reshape
* [x] reshape_as
* [ ] resize_
* [ ] resize_as_
* [ ] resolve_conj
* [ ] resolve_neg
* [ ] roll
* [ ] rot90
* [ ] rsqrt
* [ ] rsub
* [ ] scatter
* [ ] scatter_add
* [x] select
* [ ] sgn
* [ ] short
* [ ] sigmoid
* [x] sin
* [ ] sinc
* [x] sinh
* [ ] softmax
* [ ] solve
* [x] split
* [x] split_with_sizes
* [ ] sqrt
* [ ] square
* [x] squeeze
* [ ] stack
* [ ] std
* [ ] std_mean
* [ ] sum_to_size
* [ ] svd
* [ ] symeig
* [ ] t
* [ ] take
* [ ] take_along_dim
* [x] tan
* [x] tanh
* [ ] tensor_split
* [ ] tensordot
* [ ] tile
* [ ] to_sparse
* [x] trace
* [x] transpose
* [ ] trapezoid
* [ ] trapz
* [ ] triangular_solve
* [x] tril
* [x] triu
* [ ] true_divide
* [x] unfold
* [x] unsqueeze
* [ ] var
* [ ] var_mean
* [ ] vdot
* [ ] view
* [ ] view_as
* [ ] view_as_real
* [x] vsplit
* [ ] vstack
* [ ] where
* [ ] zero_
* [x] zeros_like

Misc:
* Fix tests in `test_torch.py`
    * [ ] test_copy_all_dtypes_and_devices -> Fails due to copy(x) (unsupported storage type )
    * [ ] test_copy_math_view -> Uses make_tensor
    * [ ] test_copy_transpose_math_view -> Uses make_tensor
    * [ ] (maybe?)test_copy_noncontig -> Tests only 1 dtype
    * [ ] (maybe?)test_copy_broadcast -> Tests only 1 dtype

cc: @anjali411 

### Alternatives

_No response_

### Additional context

_No response_

cc @ezyang @anjali411 @dylanbespalko @mruberry @Lezcano @nikitaved