code: def convert_to_tensor_with_default(
      value, default, dtype=None, name=None
  ):
      """Converts the given `value` to a `Tensor` or returns the `default` value.
  
      Converts the input `value` to a `Tensor` or returns `default` converted to a
      `Tensor` if `value == None`.
  
      Args:
        value: An object whose type has a registered Tensor conversion function.
        default: The value to return if `value == None`.
        dtype: Optional element type for the returned tensor. If missing, the type
          is inferred from the type of value.
        name: Optional name to use if a new Tensor is created.
  
      Returns:
        A Tensor based on value.
      """
      rtn_val = default if value is None else value
      return tf.convert_to_tensor(rtn_val, dtype=dtype, name=name)
  
file_path: tf-quant-finance/tf_quant_finance/models/utils.py
imports: import tensorflow.compat.v2
  from tf_quant_finance.math import random_ops
label_desc: Use image node_id 9 for calling a global function with example usage: convert_to_tensor_with_default(value, default, dtype, name) and returns: tf