Class ov::op::v1::Reshape

class Reshape : public ov::op::Op

Tensor dynamic reshape operation.

“Converts” an input tensor into a new shape with the same number of elements. This op does not touch the actual data. If needed, use Transpose for that purpose.

Public Functions

Reshape(const Output<Node> &arg, const Output<Node> &shape_pattern, bool special_zero)

Constructs a dynamic reshape operation. This operation does not perform transpose.

Parameters
  • arg – The tensor to be reshaped.

  • shape_pattern – The node that defines output shape shape_pattern. If the input shape is \((a_0,\dots,a_{k-1})\) then the output shape must be of the form \((b_0,\dots,b_{j-1})\) where \(\Pi(a_i) = \Pi(b_i)\). A value of -1 is allowed for at most one dimension, in which case the dimension size is inferred based on element count of input tensor.

  • special_zero – Treats zeros in shape_pattern as wildcard flags indicating a copy from input shape at the same index.

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 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.