# tensorflow::ops::Barrier Class Reference

# tensorflow::
ops::
Barrier

`
#include <data_flow_ops.h>
`


Defines a barrier that persists across different graph executions.

## Summary


A barrier represents a key-value map, where each key is a string, and each value is a tuple of tensors.


At runtime, the barrier contains 'complete' and 'incomplete' elements. A complete element has defined tensors for all components of its value tuple, and may be accessed using
[BarrierTakeMany](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier-take-many#classtensorflow_1_1ops_1_1_barrier_take_many)
. An incomplete element has some undefined components in its value tuple, and may be updated using
[BarrierInsertMany](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier-insert-many#classtensorflow_1_1ops_1_1_barrier_insert_many)
.


Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- component_types: The type of each component in a value.

<br />


Optional attributes (see
`
https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/barrier/attrs#structtensorflow_1_1ops_1_1_barrier_1_1_attrs
`
):

- shapes: The shape of each component in a value. Each shape must be 1 in the first dimension. The length of this attr must be the same as the length of component_types.
- capacity: The capacity of the barrier. The default capacity is MAX_INT32, which is the largest capacity of the underlying queue.
- container: If non-empty, this barrier is placed in the given container. Otherwise, a default container is used.
- shared_name: If non-empty, this barrier will be shared under the given name across multiple sessions.

<br />


Returns:

- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` : The handle to the barrier.

<br />

| ### Constructors and Destructors ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1ae400cc957e34014ea577177c9ee259a7 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, const DataTypeSlice & component_types) ` ||
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1a16852c2beb26f3659acdabc69c948e91 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, const DataTypeSlice & component_types, const https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/barrier/attrs#structtensorflow_1_1ops_1_1_barrier_1_1_attrs & attrs) ` ||

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1a999e0c86fdd1442995bd4dcd49f55f75 ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1a66ea0f34005305664b3a8c2b7237c73b ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation ` |

| ### Public functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1a0572d54a742a10d03a030edd48180865 () const ` | ` ::tensorflow::Node * ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1a4b6914f3b4916e256dd1b02e731c71b3 () const ` | ` ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1a00b400c1c0d2a50625e5f1deefd7510f () const ` | ` ` |

| ### Public static functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1a393954a81f232e756e680fc9e091595d (int64 x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/barrier/attrs#structtensorflow_1_1ops_1_1_barrier_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1af53271d59cca63c440ef591e790c1a0a (StringPiece x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/barrier/attrs#structtensorflow_1_1ops_1_1_barrier_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1a6f503841ebe322db85d2826f56de4fb8 (const gtl::ArraySlice< PartialTensorShape > & x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/barrier/attrs#structtensorflow_1_1ops_1_1_barrier_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier_1a704c1a8c990c6afe3854ddc6cf9d3d6e (StringPiece x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/barrier/attrs#structtensorflow_1_1ops_1_1_barrier_1_1_attrs ` |

| ### Structs ||
|---|---|
| [tensorflow:: ops:: Barrier:: Attrs](https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/barrier/attrs) | Optional attribute setters for [Barrier](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/barrier#classtensorflow_1_1ops_1_1_barrier) . |

## Public attributes

### handle

```
::tensorflow::Output handle
```

### operation

```
Operation operation
```

## Public functions

### Barrier

```
 Barrier(
  const ::tensorflow::Scope & scope,
  const DataTypeSlice & component_types
)
```

### Barrier

```
 Barrier(
  const ::tensorflow::Scope & scope,
  const DataTypeSlice & component_types,
  const Barrier::Attrs & attrs
)
```

### node

```
::tensorflow::Node * node() const 
```

### operator::tensorflow::Input

```
 operator::tensorflow::Input() const 
```

### operator::tensorflow::Output

```
 operator::tensorflow::Output() const 
```

## Public static functions

### Capacity

```
Attrs Capacity(
  int64 x
)
```

### Container

```
Attrs Container(
  StringPiece x
)
```

### Shapes

```
Attrs Shapes(
  const gtl::ArraySlice< PartialTensorShape > & x
)
```

### SharedName

```
Attrs SharedName(
  StringPiece x
)
```