aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/docs_src/api_guides/python/state_ops.md
blob: fc55ea14813ef0a20b0a30fbb35888777c5f152f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# 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_variables`
*   `tf.local_variables`
*   `tf.model_variables`
*   `tf.trainable_variables`
*   `tf.moving_average_variables`
*   `tf.global_variables_initializer`
*   `tf.local_variables_initializer`
*   `tf.variables_initializer`
*   `tf.is_variable_initialized`
*   `tf.report_uninitialized_variables`
*   `tf.assert_variables_initialized`
*   `tf.assign`
*   `tf.assign_add`
*   `tf.assign_sub`

## Saving and Restoring Variables

*   `tf.train.Saver`
*   `tf.train.latest_checkpoint`
*   `tf.train.get_checkpoint_state`
*   `tf.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_variable`
*   `tf.get_local_variable`
*   `tf.VariableScope`
*   `tf.variable_scope`
*   `tf.variable_op_scope`
*   `tf.get_variable_scope`
*   `tf.make_template`
*   `tf.no_regularizer`
*   `tf.constant_initializer`
*   `tf.random_normal_initializer`
*   `tf.truncated_normal_initializer`
*   `tf.random_uniform_initializer`
*   `tf.uniform_unit_scaling_initializer`
*   `tf.zeros_initializer`
*   `tf.ones_initializer`
*   `tf.orthogonal_initializer`

## Variable Partitioners for Sharding

*   `tf.fixed_size_partitioner`
*   `tf.variable_axis_size_partitioner`
*   `tf.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_update`
*   `tf.scatter_add`
*   `tf.scatter_sub`
*   `tf.scatter_mul`
*   `tf.scatter_div`
*   `tf.scatter_min`
*   `tf.scatter_max`
*   `tf.scatter_nd_update`
*   `tf.scatter_nd_add`
*   `tf.scatter_nd_sub`
*   `tf.sparse_mask`
*   `tf.IndexedSlices`

### Read-only Lookup Tables

*   `tf.initialize_all_tables`
*   `tf.tables_initializer`


## Exporting and Importing Meta Graphs

*   `tf.train.export_meta_graph`
*   `tf.train.import_meta_graph`

# Deprecated functions (removed after 2017-03-02). Please don't use them.

*   `tf.all_variables`
*   `tf.initialize_all_variables`
*   `tf.initialize_local_variables`
*   `tf.initialize_variables`