``` #include <array_ops.h> ```

Broadcast an array for a compatible shape.

## Summary

Broadcasting is the process of making arrays to have compatible shapes for arithmetic operations. Two shapes are compatible if for each dimension pair they are either equal or one of them is one. When trying to broadcast a Tensor to a shape, it starts with the trailing dimensions, and works its way forward.

For example,

x = tf.constant([1, 2, 3]) y = tf.broadcast_to(x, [3, 3]) print(y) tf.Tensor( [[1 2 3] [1 2 3] [1 2 3]], shape=(3, 3), dtype=int32)

In the above example, the input Tensor with the shape of ``` [1, 3] ``` is broadcasted to output Tensor with shape of ``` [3, 3] ``` .

When doing broadcasted operations such as multiplying a tensor by a scalar, broadcasting (usually) confers some time or space benefit, as the broadcasted tensor is never materialized.

However, ``` broadcast_to ``` does not carry with it any such benefits. The newly-created tensor takes the full memory of the broadcasted shape. (In a graph context, ``` broadcast_to ``` might be fused to subsequent operation and then be optimized away, however.)

Args:

• scope: A Scope object
• input: A Tensor to broadcast.
• shape: An 1-D ``` int ``` Tensor . The shape of the desired output.

Returns:

• ``` Output ``` : A Tensor .

### Constructors and Destructors

``` BroadcastTo (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input shape) ```

### Public attributes

``` operation ```
``` Operation ```
``` output ```
``` :: tensorflow::Output ```

### Public functions

``` node () const ```
``` ::tensorflow::Node * ```
``` operator::tensorflow::Input () const ```
``` ```
``` operator::tensorflow::Output () const ```
``` ```

## Public attributes

### operation

`Operation operation`

### output

`::tensorflow::Output output`

## Public functions

``` BroadcastTo(
const ::tensorflow::Scope & scope,
::tensorflow::Input input,
::tensorflow::Input shape
)```

### node

`::tensorflow::Node * node() const `

### operator::tensorflow::Input

` operator::tensorflow::Input() const `

### operator::tensorflow::Output

` operator::tensorflow::Output() const `
[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]
{"lastModified": "Last updated 2021-05-14 UTC."}