ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

tf.Variable

See the variable guide.

Used in the notebooks

Used in the guide Used in the tutorials

A variable maintains shared, persistent state manipulated by a program.

The Variable() constructor requires an initial value for the variable, which can be a Tensor of any type and shape. This initial value defines the type and shape of the variable. After construction, the type and shape of the variable are fixed. The value can be changed using one of the assign methods.