get_variables_as_dict

tfsnippet.utils.get_variables_as_dict(scope=None, collection='variables')

Get TensorFlow variables as dict.

Parameters:
  • scope (str or tf.VariableScope or None) – If None, will collect all the variables within current graph. If a str or a tf.VariableScope, will collect the variables only from this scope. (default None)
  • collection (str) – Collect the variables only from this collection. (default tf.GraphKeys.GLOBAL_VARIABLES)
Returns:

Dict which maps from names to TensorFlow

variables. The names will be the full names of variables if scope is not specified, or the relative names within the scope otherwise. By relative names we mean the variable names without the common scope name prefix.

Return type:

dict[str, tf.Variable]