def _safe_convert_to_tensor(val, dtype=None) -> TfVal:
    dtype = (dtype if dtype else (val.dtype if hasattr(val, 'dtype') else None))
    conversion_type = (to_tf_dtype(dtype) if dtype else None)
    if (dtype and (dtype == dtypes.float0)):
        val = np.zeros(np.shape(val), conversion_type.as_numpy_dtype)
    return tf.convert_to_tensor(val, dtype=conversion_type)
def _safe_convert_to_tensor(val, dtype=None) -> TfVal:
    dtype = (dtype if dtype else (val.dtype if hasattr(val, 'dtype') else None))
    conversion_type = (to_tf_dtype(dtype) if dtype else None)
    if (dtype and (dtype == dtypes.float0)):
        val = np.zeros(np.shape(val), conversion_type.as_numpy_dtype)
    return tf.convert_to_tensor(val, dtype=conversion_type)