tensorflow::ops::BroadcastTo

#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])
>>> sess.run(y)
array([[1, 2, 3],
       [1, 2, 3],
       [1, 2, 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].

Arguments:

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

Returns:

Constructors and Destructors
BroadcastTo(const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input shape)
Public attributes
operation
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

 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 

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/broadcast-to