---
title: "concatTensor(_:with:dimension:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/concattensor(_:with:dimension:name:)"
---

# concatTensor(_:with:dimension:name:)

Creates a concatenation operation and returns the result tensor.

## Declaration

```swift
func concatTensor(_ tensor: MPSGraphTensor, with tensor2: MPSGraphTensor, dimension dimensionIndex: Int, name: String?) -> MPSGraphTensor
```

## Parameters

- `tensor`: The first tensor to concatenate.
- `tensor2`: The second tensor to concatenate.
- `dimensionIndex`: The dimension to concatenate across, must be in range: -rank <= dimension < rank.
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object.

## Discussion

Discussion Concatenates two input tensors along the specified dimension. Tensors must be broadcast compatible along all other dimensions, and have the same datatype.
