Class ov::op::v7::Einsum

class Einsum : public ov::op::Op

Einsum operation.

Public Functions

Einsum(const OutputVector &inputs, const std::string &equation)

Constructs Einsum operation.

  • inputsInput nodes on which Einsum operation performs contraction

  • equation – Einstein summation convention

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.

void set_equation(std::string equation)

Set Einsum equation.


equation – Equation string to be set.

inline const std::string &get_equation() const

Get an equation of Einsum operation.


Einsum equation

Public Static Functions

static void parse_equation(const std::string &equation, std::vector<std::string> &input_subscripts, std::string &output_subscript)

Check correctness of equation format and extract input subscripts and output subscript.

  • equation – Equation to be parsed and checked

  • input_subscripts – A vector of extracted input subscripts

  • output_subscript – An output subscript

static std::vector<std::string> extract_labels(const std::string &subscript)

Extract labels (from subscript) that can be alphabetic letters or ellipsis.


subscript – Subscript


A vector of extracted labels from the input subscript in the order of appearence