---
title: "broadcast(_:shape:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/broadcast(_:shape:name:)"
---

# broadcast(_:shape:name:)

Creates a broadcast operation and returns the result tensor.

## Declaration

```swift
func broadcast(_ tensor: MPSGraphTensor, shape: [NSNumber], name: String?) -> MPSGraphTensor
```

## Parameters

- `tensor`: The tensor to be broadcasted
- `shape`: The shape of the result tensor.
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object

## Discussion

Discussion Broadcasts values inside the tensor, starting from the trailing dimensions, to give it the correct shape. This is equivalent to the broadcasting for arithmetic operations when operands have different shapes.
