Variables
Note: Functions taking Tensor arguments can also take anything accepted by tf.convert_to_tensor.
[TOC]
Variables
tf.Variable
Variable helper functions
TensorFlow provides a set of functions to help manage the set of variables collected in the graph.
tf.global_variablestf.local_variablestf.model_variablestf.trainable_variablestf.moving_average_variablestf.global_variables_initializertf.local_variables_initializertf.variables_initializertf.is_variable_initializedtf.report_uninitialized_variablestf.assert_variables_initializedtf.assigntf.assign_addtf.assign_sub
Saving and Restoring Variables
tf.train.Savertf.train.latest_checkpointtf.train.get_checkpoint_statetf.train.update_checkpoint_state
Sharing Variables
TensorFlow provides several classes and operations that you can use to create variables contingent on certain conditions.
tf.get_variabletf.get_local_variabletf.VariableScopetf.variable_scopetf.variable_op_scopetf.get_variable_scopetf.make_templatetf.no_regularizertf.constant_initializertf.random_normal_initializertf.truncated_normal_initializertf.random_uniform_initializertf.uniform_unit_scaling_initializertf.zeros_initializertf.ones_initializertf.orthogonal_initializer
Variable Partitioners for Sharding
tf.fixed_size_partitionertf.variable_axis_size_partitionertf.min_max_variable_partitioner
Sparse Variable Updates
The sparse update ops modify a subset of the entries in a dense Variable, either overwriting the entries or adding / subtracting a delta. These are useful for training embedding models and similar lookup-based networks, since only a small subset of embedding vectors change in any given step.
Since a sparse update of a large tensor may be generated automatically during gradient computation (as in the gradient of tf.gather), an tf.IndexedSlices class is provided that encapsulates a set of sparse indices and values. IndexedSlices objects are detected and handled automatically by the optimizers in most cases.
tf.scatter_updatetf.scatter_addtf.scatter_subtf.scatter_multf.scatter_divtf.scatter_mintf.scatter_maxtf.scatter_nd_updatetf.scatter_nd_addtf.scatter_nd_subtf.sparse_masktf.IndexedSlices
Read-only Lookup Tables
tf.initialize_all_tablestf.tables_initializer
Exporting and Importing Meta Graphs
tf.train.export_meta_graphtf.train.import_meta_graph
Deprecated functions (removed after 2017-03-02). Please don't use them.
tf.all_variablestf.initialize_all_variablestf.initialize_local_variablestf.initialize_variables
