# tf.raw_ops.VariableV2

<br />

Holds state in the form of a tensor that persists across steps.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.raw_ops.VariableV2`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/VariableV2)

<br />

    tf.raw_ops.VariableV2(
        shape, dtype, container='', shared_name='', name=None
    )

Outputs a ref to the tensor state so it may be read or modified.

about sharing states in tensorflow.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `shape` | A [`tf.TensorShape`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/TensorShape) or list of `ints`. The shape of the variable tensor. |
| `dtype` | A [`tf.DType`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/dtypes/DType). The type of elements in the variable tensor. |
| `container` | An optional `string`. Defaults to `""`. If non-empty, this variable is placed in the given container. Otherwise, a default container is used. |
| `shared_name` | An optional `string`. Defaults to `""`. If non-empty, this variable is named in the given bucket with this shared_name. Otherwise, the node name is used instead. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A mutable `Tensor` of type `dtype`. ||

<br />