broadcast_to

ivy.broadcast_to(x, newshape, f=None)[source]

Broadcast the input tensor to newshape, adding dimensions of size 1 where the dimensions do not align.

Parameters
  • x (array) – Tensor to be broadcast to new shape.

  • newshape (sequence of ints) – The new shape the tensor should be broadcast to.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

Newly broadcast array.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty