Note: Functions takingTensorarguments can also take anything accepted bytf.convert_to_tensor.
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_subtf.train.Savertf.train.latest_checkpointtf.train.get_checkpoint_statetf.train.update_checkpoint_stateTensorFlow 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_initializerThe 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
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_guides/python/state_ops