torch.get_real_dtype
Get the underlying real dtype for a complex dtype.
For complex types, returns the dtype of the real/imaginary components. For real types, returns the dtype unchanged.
Parameters
dtypeDType- The data type to check
Returns
DType– float32 for complex64, otherwise the input dtype unchangedExamples
torch.get_real_dtype('complex64'); // 'float32'
torch.get_real_dtype('float32'); // 'float32'
torch.get_real_dtype('int32'); // 'int32'