code: def transform_string_replace(source, needle, haystack, name=None):
      
  
      with ops.name_scope(name, "TransformStringReplace", [source]):
          source = convert_to_tensor_or_sparse_tensor(source, dtype=tf.string)
          if isinstance(source, tf.SparseTensor):
              result = tf.SparseTensor(
                  indices=source.indices,
                  values=ops_module.transform_string_replace(source.values, needle, haystack),
                  dense_shape=source.dense_shape
              )
          else:
              result = ops_module.transform_string_replace(source, needle, haystack)
  
      return result
docs: Replace all substrings from `needle` to corresponding strings in `haystack` with source.
  
      Args:
          source: `Tensor` or `SparseTensor` of any shape, source strings for replacing.
          needle: List of strings to search in source
          haystack: List of strings to replace with. Should have same length as `needle`.
          name: A name for the operation (optional).
      Returns:
          `Tensor` or `SparseTensor` of same shape and size as input.