code: def ensure_dtype(input, dtype):
      """ensure_dtype
  
      If input is dtype, return input
  
      else cast input into dtype
  
      Args:
          input: Input tensor
  
          dtype: a string of type
  
      Return:
          If input is dtype, return input, else cast input into dtype
      """
      if str(input.dtype) == dtype:
          return input
      else:
          return L.cast(input, dtype=dtype)
  
file_path: PGL/legacy/pgl/utils/paddle_helper.py
imports: import warnings
  import numpy
  import paddle
  from paddle.fluid import core
  import paddle.fluid
  import paddle.fluid.layer_helper
  import paddle.fluid.layers
  from pgl.utils.logger import log
label_desc: Use image node_id 8 for calling a global function with example usage: ensure_dtype(input, dtype) and returns: input, L