def _convert_element_type(operand, *, new_dtype, weak_type=False):
    old_dtype = operand.dtype.as_numpy_dtype
    if (dtypes.issubdtype(old_dtype, np.complexfloating) and (not dtypes.issubdtype(new_dtype, np.complexfloating))):
        operand = tf.math.real(operand)
    if (dtypes.issubdtype(old_dtype, np.floating) and (not (dtypes.issubdtype(new_dtype, np.floating) or dtypes.issubdtype(new_dtype, np.complexfloating) or (new_dtype == np.bool_)))):
        sign = _sign(operand)
        operand = (sign * tf.math.floor((sign * operand)))
    return tf.dtypes.cast(operand, to_tf_dtype(new_dtype))
def _convert_element_type(operand, *, new_dtype, weak_type=False):
    old_dtype = operand.dtype.as_numpy_dtype
    if (dtypes.issubdtype(old_dtype, np.complexfloating) and (not dtypes.issubdtype(new_dtype, np.complexfloating))):
        operand = tf.math.real(operand)
    if (dtypes.issubdtype(old_dtype, np.floating) and (not (dtypes.issubdtype(new_dtype, np.floating) or dtypes.issubdtype(new_dtype, np.complexfloating) or (new_dtype == np.bool_)))):
        sign = _sign(operand)
        operand = (sign * tf.math.floor((sign * operand)))
    return tf.dtypes.cast(operand, to_tf_dtype(new_dtype))