Developer Guide and Reference

  • 2022.1
  • 04/11/2022
  • Public Content
Contents

Concat

General

The concat primitive concatenates LaTex Math image. tensors over
concat_dimension
(here designated LaTex Math image.) and is defined as (the variable names follow the standard Naming Conventions):
LaTex Math image.
where LaTex Math image..
The concat primitive does not have a notion of forward or backward propagation. The backward propagation for the concatenation operation is simply an identity operation.

Execution Arguments

When executed, the inputs and outputs should be mapped to an execution argument index as specified by the following table.
Primitive input/output
Execution argument index
LaTex Math image.
DNNL_ARG_MULTIPLE_SRC
LaTex Math image.
DNNL_ARG_DST

Implementation Details

General Notes
  1. The LaTex Math image. memory format can be either specified by a user or derived by the primitive. The recommended way is to allow the primitive to choose the most appropriate format.
  2. The concat primitive requires all source and destination tensors to have the same shape except for the
    concat_dimension
    . The destination dimension for the
    concat_dimension
    must be equal to the sum of the
    concat_dimension
    dimensions of the sources (i.e. LaTex Math image.). Implicit broadcasting is not supported.
Data Types Support
The concat primitive supports arbitrary data types for source and destination tensors according to the Data Types page. However, it is required that all source tensors are of the same data type (but not necessarily matching the data type of the destination tensor).
Data Representation
The concat primitive works with arbitrary data tensors. There is no special meaning associated with any logical dimensions.
Post-Ops and Attributes
The concat primitive does not support any post-ops or attributes.

Implementation Limitations

  1. The primitive works with several memory formats, such as plain formats dnnl_nchw, dnnl_nhwc, and blocked formats dnnl_nChw16c, dnnl_nCdhw8c that appear in convolutions. The primitive does not support non-blocked formats that are typically used in prepacked weights, such as:
  2. Refer to Data Types for limitations related to data types support.

Performance Tips

  1. Whenever possible, avoid specifying the destination memory format so that the primitive is able to choose the most appropriate one.
  2. The concat primitive is highly optimized for the cases in which all source tensors have same memory format and data type matches the destination tensor data type. For other cases, more general but slower code is working. Consider reordering sources to the same data format before using the concat primitive.

Example

This C++ API example demonstrates how to create and execute a Concat primitive.
Key optimizations included in this example:
  • Identical source (src) memory formats.
  • Creation of optimized memory format for destination (dst) from the primitive descriptor

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.