interface ngraph::snippets::op::Subgraph

Overview

An operation that is implemented by a model. More…

#include <subgraph.hpp>

template Subgraph: public ov::op::util::SubGraphOp
{
    // typedefs

    typedef std::tuple<ngraph::Shape, ngraph::AxisVector, ngraph::element::Type> BlockedShape;
    typedef std::vector<BlockedShape> BlockedShapeVector;

    // fields

     BWDCMP_RTTI_DECLARATION;
    bool m_is_quantized = false;
    bool m_is_needed_to_align_precision = false;
    bool m_has_type_relaxed_ops = false;

    // construction

    Subgraph();
    Subgraph(const OutputVector& args, std::shared_ptr<ov::Model> body);
    Subgraph(const NodeVector& args, std::shared_ptr<ov::Model> body);

    // methods

    OPENVINO_OP("Subgraph", "SnippetsOpset", ov::op::util::SubGraphOp);
    virtual bool visit_attributes(AttributeVisitor& visitor);
    virtual void validate_and_infer_types();
    std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& inputs) const;
    const std::shared_ptr<ov::Model>& body_ptr() const;
    std::shared_ptr<ov::Model>& body_ptr();
    const ov::Model& body() const;
    ov::Model& body();
    const std::shared_ptr<ngraph::snippets::Generator>& get_generator() const;
    std::shared_ptr<ngraph::snippets::Generator>& get_generator();
    size_t get_non_scalar_constants_count() const;
    bool is_quantized() const;
    bool has_type_relaxed_ops() const;

    snippets::Schedule generate(
        const BlockedShapeVector& output_shapes,
        const BlockedShapeVector& input_shapes,
        ngraph::pass::Manager& opt,
        const void \* compile_params = nullptr
        );

    snippets::Schedule generate(
        const BlockedShapeVector& output_shapes,
        const BlockedShapeVector& input_shapes,
        const void \* compile_params = nullptr
        );

    snippets::Schedule generate(
        ngraph::pass::Manager& opt,
        const void \* compile_params = nullptr
        );

    snippets::Schedule generate(const void \* compile_params = nullptr);

    Shape canonicalize(
        const BlockedShapeVector& output_shapes,
        const BlockedShapeVector& input_shapes
        );

    void set_generator(std::shared_ptr<ngraph::snippets::Generator> generator);
    void set_non_scalar_constants_count(const size_t count);
    void print() const;
    void print_statistics(bool verbose);
    void serialize() const;
    static auto wrap_node_as_subgraph(const std::shared_ptr<ngraph::Node>& node);

    static void fill_empty_output_names(
        const Output<Node>& target_output_node,
        const Output<Node>& replacement_output_node
        );
};

Inherited Members

public:
    // typedefs

    typedef DiscreteTypeInfo type_info_t;
    typedef std::map<std::string, Any> RTMap;
    typedef std::vector<MultiSubGraphOp::InputDescription::Ptr> MultiSubgraphInputDescriptionVector;
    typedef std::vector<MultiSubGraphOp::OutputDescription::Ptr> MultiSubgraphOutputDescriptionVector;

    // classes

    class BodyOutputDescription;
    class ConcatOutputDescription;
    class InputDescription;
    class InvariantInputDescription;
    class MergedInputDescription;
    class OutputDescription;
    class SliceInputDescription;

    // fields

     BWDCMP_RTTI_DECLARATION;
     BWDCMP_RTTI_DECLARATION;

    // methods

    virtual void validate_and_infer_types();
    void constructor_validate_and_infer_types();
    virtual bool visit_attributes(AttributeVisitor&);
    virtual const ov::op::AutoBroadcastSpec& get_autob() const;
    virtual bool has_evaluate() const;

    virtual bool evaluate(
        const ov::HostTensorVector& output_values,
        const ov::HostTensorVector& input_values
        ) const;

    virtual bool evaluate(
        const ov::HostTensorVector& output_values,
        const ov::HostTensorVector& input_values,
        const EvaluationContext& evaluationContext
        ) const;

    virtual bool evaluate_lower(const ov::HostTensorVector& output_values) const;
    virtual bool evaluate_upper(const ov::HostTensorVector& output_values) const;

    virtual bool evaluate(
        ov::TensorVector& output_values,
        const ov::TensorVector& input_values
        ) const;

    virtual bool evaluate(
        ov::TensorVector& output_values,
        const ov::TensorVector& input_values,
        const ov::EvaluationContext& evaluationContext
        ) const;

    virtual bool evaluate_lower(ov::TensorVector& output_values) const;
    virtual bool evaluate_upper(ov::TensorVector& output_values) const;
    virtual bool evaluate_label(TensorLabelVector& output_labels) const;

    virtual bool constant_fold(
        OutputVector& output_values,
        const OutputVector& inputs_values
        );

    virtual OutputVector decompose_op() const;
    virtual const type_info_t& get_type_info() const = 0;
    const char \* get_type_name() const;
    void set_arguments(const NodeVector& arguments);
    void set_arguments(const OutputVector& arguments);
    void set_argument(size_t position, const Output<Node>& argument);

    void set_output_type(
        size_t i,
        const element::Type& element_type,
        const PartialShape& pshape
        );

    void set_output_size(size_t output_size);
    void invalidate_values();
    virtual void revalidate_and_infer_types();
    virtual std::string description() const;
    const std::string& get_name() const;
    void set_friendly_name(const std::string& name);
    const std::string& get_friendly_name() const;
    virtual bool is_dynamic() const;
    size_t get_instance_id() const;
    virtual std::ostream& write_description(std::ostream& os, uint32_t depth = 0) const;
    const std::vector<std::shared_ptr<Node>>& get_control_dependencies() const;
    const std::vector<Node \*>& get_control_dependents() const;
    void add_control_dependency(std::shared_ptr<Node> node);
    void remove_control_dependency(std::shared_ptr<Node> node);
    void clear_control_dependencies();
    void clear_control_dependents();
    void add_node_control_dependencies(std::shared_ptr<Node> source_node);
    void add_node_control_dependents(std::shared_ptr<Node> source_node);
    void transfer_control_dependents(std::shared_ptr<Node> replacement);
    size_t get_output_size() const;
    const element::Type& get_output_element_type(size_t i) const;
    const element::Type& get_element_type() const;
    const Shape& get_output_shape(size_t i) const;
    const PartialShape& get_output_partial_shape(size_t i) const;
    Output<const Node> get_default_output() const;
    Output<Node> get_default_output();
    virtual size_t get_default_output_index() const;
    size_t no_default_index() const;
    const Shape& get_shape() const;
    descriptor::Tensor& get_output_tensor(size_t i) const;
    descriptor::Tensor& get_input_tensor(size_t i) const;
    const std::string& get_output_tensor_name(size_t i) const;
    std::set<Input<Node>> get_output_target_inputs(size_t i) const;
    size_t get_input_size() const;
    const element::Type& get_input_element_type(size_t i) const;
    const Shape& get_input_shape(size_t i) const;
    const PartialShape& get_input_partial_shape(size_t i) const;
    const std::string& get_input_tensor_name(size_t i) const;
    Node \* get_input_node_ptr(size_t index) const;
    std::shared_ptr<Node> get_input_node_shared_ptr(size_t index) const;
    Output<Node> get_input_source_output(size_t i) const;
    virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& inputs) const = 0;
    std::shared_ptr<Node> copy_with_new_inputs(const OutputVector& new_args) const;

    std::shared_ptr<Node> copy_with_new_inputs(
        const OutputVector& inputs,
        const std::vector<std::shared_ptr<Node>>& control_dependencies
        ) const;

    bool has_same_type(std::shared_ptr<const Node> node) const;
    RTMap& get_rt_info();
    const RTMap& get_rt_info() const;
    NodeVector get_users(bool check_is_used = false) const;
    virtual size_t get_version() const;
    virtual std::shared_ptr<Node> get_default_value() const;
    bool operator < (const Node& other) const;
    std::vector<Input<Node>> inputs();
    std::vector<Input<const Node>> inputs() const;
    std::vector<Output<Node>> input_values() const;
    std::vector<Output<Node>> outputs();
    std::vector<Output<const Node>> outputs() const;
    Input<Node> input(size_t input_index);
    Input<const Node> input(size_t input_index) const;
    Output<Node> input_value(size_t input_index) const;
    Output<Node> output(size_t output_index);
    Output<const Node> output(size_t output_index) const;
    OPENVINO_SUPPRESS_DEPRECATED_START void set_op_annotations(std::shared_ptr<ngraph::op::util::OpAnnotations> op_annotations);
    std::shared_ptr<ngraph::op::util::OpAnnotations> get_op_annotations() const;

    virtual OPENVINO_SUPPRESS_DEPRECATED_END bool match_value(
        ov::pass::pattern::Matcher \* matcher,
        const Output<Node>& pattern_value,
        const Output<Node>& graph_value
        );

    virtual bool match_node(
        ov::pass::pattern::Matcher \* matcher,
        const Output<Node>& graph_value
        );

    static _OPENVINO_HIDDEN_METHODconst ::ov::Node::type_info_t& get_type_info_static();
    virtual const ::ov::Node::type_info_t& get_type_info() const;
    OPENVINO_OP("MultiSubGraphOp", "util");
    virtual const std::shared_ptr<Model>& get_function(int index) const;
    virtual void set_function(int index, const std::shared_ptr<Model>& func);
    const MultiSubgraphInputDescriptionVector& get_input_descriptions(int index) const;
    MultiSubgraphInputDescriptionVector& get_input_descriptions(int index);
    const MultiSubgraphOutputDescriptionVector& get_output_descriptions(int index) const;
    MultiSubgraphOutputDescriptionVector& get_output_descriptions(int index);

    void set_input_descriptions(
        int index,
        const MultiSubgraphInputDescriptionVector& inputs
        );

    void set_output_descriptions(
        int index,
        const MultiSubgraphOutputDescriptionVector& outputs
        );

    virtual void set_invariant_inputs(
        const Output<Node>& value,
        const ov::ParameterVector& bodies_parameters
        );

    virtual Output<Node> set_body_outputs(const ResultVector& bodies_results);
    virtual size_t get_internal_subgraphs_size() const;
    virtual size_t get_input_descriptions_size() const;
    virtual size_t get_output_descriptions_size() const;
    bool get_transformations_allowed() const;
    MultiSubGraphOp& operator = (const MultiSubGraphOp&);
    MultiSubGraphOp& operator = (MultiSubGraphOp&&);
    OPENVINO_OP("SubGraphOp", "util", op::util::MultiSubGraphOp);
    virtual const std::shared_ptr<Model>& get_function() const;
    virtual void set_function(const std::shared_ptr<Model>& func);
    const std::vector<std::shared_ptr<InputDescription>>& get_input_descriptions() const;
    std::vector<std::shared_ptr<InputDescription>>& get_input_descriptions();
    const std::vector<std::shared_ptr<OutputDescription>>& get_output_descriptions() const;
    std::vector<std::shared_ptr<OutputDescription>>& get_output_descriptions();

    virtual void set_sliced_input(
        const std::shared_ptr<ov::op::v0::Parameter>& parameter,
        const Output<Node>& value,
        int64_t start,
        int64_t stride,
        int64_t part_size,
        int64_t end,
        int64_t axis
        );

    virtual void set_merged_input(
        const std::shared_ptr<ov::op::v0::Parameter>& body_parameter,
        const Output<Node>& initial_value,
        const Output<Node>& successive_value
        );

    virtual void set_invariant_input(
        const std::shared_ptr<ov::op::v0::Parameter>& body_parameter,
        const Output<Node>& value
        );

    virtual Output<Node> get_iter_value(
        const Output<Node>& body_value,
        int64_t iteration = -1
        );

    virtual Output<Node> get_concatenated_slices(
        const Output<Node>& value,
        int64_t start,
        int64_t stride,
        int64_t part_size,
        int64_t end,
        int64_t axis
        );

    SubGraphOp& operator = (const SubGraphOp&);
    SubGraphOp& operator = (SubGraphOp&&);
    int64_t get_num_iterations() const;

Detailed Documentation

An operation that is implemented by a model.

Methods

virtual void validate_and_infer_types()

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.