/TensorFlow Python



Defined in tensorflow/contrib/metrics/python/ops/metric_ops.py.

See the guide: Metrics (contrib) > Metric Ops

Concatenate values along an axis across batches.

The function streaming_concat creates two local variables, array and size, that are used to store concatenated values. Internally, array is used as storage for a dynamic array (if maxsize is None), which ensures that updates can be run in amortized constant time.

For estimation of the metric over a stream of data, the function creates an update_op operation that appends the values of a tensor and returns the length of the concatenated axis.

This op allows for evaluating metrics that cannot be updated incrementally using the same framework as other streaming metrics.


  • values: Tensor to concatenate. Rank and the shape along all axes other than the axis to concatenate along must be statically known.
  • axis: optional integer axis to concatenate along.
  • max_size: optional integer maximum size of value along the given axis. Once the maximum size is reached, further updates are no-ops. By default, there is no maximum size: the array is resized as necessary.
  • metrics_collections: An optional list of collections that value should be added to.
  • updates_collections: An optional list of collections update_op should be added to.
  • name: An optional variable_scope name.


  • value: A Tensor representing the concatenated values.
  • update_op: An operation that concatenates the next values.


  • ValueError: if values does not have a statically known rank, axis is not in the valid range or the size of values is not statically known along any axis other than axis.

© 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.