aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Alexandre Passos <apassos@google.com>2018-01-11 11:20:21 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-11 11:24:16 -0800
commit99b0397e75e37af72eb77fb8f01d3bc955f6ae64 (patch)
tree26f9311f31b28b2ef162ecc7eadcabaa79a15d7b
parent453f94412f908aadd21561c14feae80dfac1e933 (diff)
Comments for the functors in concat_lib
PiperOrigin-RevId: 181635835
-rw-r--r--tensorflow/core/kernels/concat_lib.h16
1 files changed, 16 insertions, 0 deletions
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 <typename T>
void ConcatCPU(DeviceBase* d,