From 99b0397e75e37af72eb77fb8f01d3bc955f6ae64 Mon Sep 17 00:00:00 2001 From: Alexandre Passos Date: Thu, 11 Jan 2018 11:20:21 -0800 Subject: Comments for the functors in concat_lib PiperOrigin-RevId: 181635835 --- tensorflow/core/kernels/concat_lib.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tensorflow/core/kernels/concat_lib.h b/tensorflow/core/kernels/concat_lib.h index 14e6e1bc32..526f9420d7 100644 --- a/tensorflow/core/kernels/concat_lib.h +++ b/tensorflow/core/kernels/concat_lib.h @@ -23,6 +23,22 @@ limitations under the License. namespace tensorflow { +// Functors to concatenate tensors. These always take a rank-2 tensor (i.e a +// matrix) and concatenate it along the axis 1 ("putting them next to each +// other" as opposed to "putting them on top of one another"). +// +// Any concatenation of n-dimensional tensors across any axis can be reduced to +// a concatenation of two-dimensional tensors across the axis 1 by first +// partitioning the axes of the original tensors into those less than the axis +// to be concatenated across and the rest. Then reshape the tensors into a +// two-dimensional tensor by collapsing these two sets of axes and concatenate +// the resulting matrices across the axis 1, finally reshaping the result to +// have the proper shape. +// +// So, for example, when stacking N tensors, reshape each to have shape +// {1, Numelements} and reshape the result matrix to have shape +// {1, N * NumElements} before passing it to this functor. + // Assumes all inputs are nonempty template void ConcatCPU(DeviceBase* d, -- cgit v1.2.3