tf.keras.ops.broadcast_to
Broadcast a tensor to a new shape.
tf.keras.ops.broadcast_to(
x, shape
)
Args |
x
|
The tensor to broadcast.
|
shape
|
The shape of the desired tensor. A single integer i is
interpreted as (i,) .
|
Returns |
A tensor with the desired shape.
|
Examples:
x = keras.ops.array([1, 2, 3])
keras.ops.broadcast_to(x, (3, 3))
array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-06-07 UTC.
[null,null,["Last updated 2024-06-07 UTC."],[],[]]