fn
imag
→Tensorimag(input: Tensor)Imaginary part of a complex tensor.
For complex inputs, returns the imaginary component as a real-valued tensor of the same shape; for real inputs it returns a zero tensor.
Parameters
inputTensorInput tensor.
Returns
TensorElement-wise result with the same shape as input.
Notes
Mathematical definition:
Gradient flows back as the imaginary part of the upstream cotangent.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> lucid.imag(x)
Tensor([...])