parameters: (model_dir)
return_statement: return model_dir or model_dir_in_tf_config
docstring: Returns `model_dir` based user provided `model_dir` or `TF_CONFIG`.
docstring_summary: Returns `model_dir` based user provided `model_dir` or `TF_CONFIG`.
docstring_tokens: Returns model_dir based user provided model_dir or TF_CONFIG .
function: def _get_model_dir(model_dir):
    """Returns `model_dir` based user provided `model_dir` or `TF_CONFIG`."""
  
    model_dir_in_tf_config = json.loads(
        os.environ.get('TF_CONFIG') or '{}').get('model_dir', None)
    if model_dir_in_tf_config is not None:
      if model_dir is not None and model_dir_in_tf_config != model_dir:
        raise ValueError(
            '`model_dir` provided in RunConfig construct, if set, '
            'must have the same value as the model_dir in TF_CONFIG. '
            'model_dir: {}\nTF_CONFIG["model_dir"]: {}.\n'.format(
                model_dir, model_dir_in_tf_config))
  
      logging.info('Using model_dir in TF_CONFIG: %s', model_dir_in_tf_config)
  
    return model_dir or model_dir_in_tf_config
function_tokens: def _get_model_dir ( model_dir ) : model_dir_in_tf_config = json . loads ( os . environ . get ( 'TF_CONFIG' ) or '{}' ) . get ( 'model_dir' , None ) if model_dir_in_tf_config is not None : if model_dir is not None and model_dir_in_tf_config != model_dir : raise ValueError ( '`model_dir` provided in RunConfig construct, if set, ' 'must have the same value as the model_dir in TF_CONFIG. ' 'model_dir: {}\nTF_CONFIG["model_dir"]: {}.\n' . format ( model_dir , model_dir_in_tf_config ) ) logging . info ( 'Using model_dir in TF_CONFIG: %s' , model_dir_in_tf_config ) return model_dir or model_dir_in_tf_config