keras/src/ops/numpy.py/Imag/compute_output_spec
class Imag:    def compute_output_spec(self, x):
        sparse = getattr(x, "sparse", False)
        return KerasTensor(x.shape, dtype=x.dtype, sparse=sparse)