Class ov::op::v3::Broadcast

class Broadcast : public ov::op::util::BroadcastBase

Operation which “adds” axes to an input tensor, replicating elements from the input as needed along the new axes.

Public Functions

Broadcast() = default

Constructs a broadcast operation.

Broadcast(const Output<Node> &arg, const Output<Node> &target_shape, const Output<Node> &axes_mapping, const BroadcastModeSpec &broadcast_spec = BroadcastType::EXPLICIT)

Constructs a broadcast operation.

Parameters
  • arg – The input tensor to be broadcast.

  • target_shape – The shape of the output tensor.

  • axes_mapping – The axis positions (0-based) in the result that correspond to input axes. ‘Arg’ tensor is broadcast along the remaining axes. E.g., Input Shape - [3, 4], Target Shape - [3, 5, 4, 4] axes_mapping - [0, 2] => Broadcast along axes 1 and 3. axes_mapping - [0, 3] => Broadcast along axes 1 and 2.

  • broadcast_specBroadcast specification to use for determining broadcast axes. ‘axes_mapping’ should not be provided if mode other than explicit (none) is used.

Broadcast(const Output<Node> &arg, const Output<Node> &target_shape, const BroadcastModeSpec &broadcast_spec = BroadcastType::NUMPY)

Constructs a broadcast operation.

Parameters
  • arg – The input tensor to be broadcast.

  • target_shape – The shape of the output tensor.

  • broadcast_specBroadcast specification to use for determining broadcast axes

virtual void validate_and_infer_types() override

Verifies that attributes and inputs are consistent and computes output shapes and element types. Must be implemented by concrete child classes so that it can be run any number of times.

Throws if the node is invalid.

virtual std::pair<bool, AxisSet> get_broadcast_axes() const override
Returns

true and the AxisSet if broadcast axes can be fully determined.

virtual bool evaluate(ov::TensorVector &outputs, const ov::TensorVector &inputs) const override

Evaluates the op on input_values putting results in output_values.

Parameters
  • output_values – Tensors for the outputs to compute. One for each result

  • input_values – Tensors for the inputs. One for each inputs.

Returns

true if successful

virtual bool has_evaluate() const override

Allows to get information about availability of evaluate method for the current operation.