def _float_weights_or_none(weights): if weights is None: return None return math_ops.to_float(weights)