Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

1.6 KB
Raw Blame
// Copyright (C) 2018-2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include <string>
#include <vector>

#include "helper_ops/internal_operation.hpp"

namespace ov::frontend::tensorflow {

class Iterator : public InternalOperation {
public:
    OPENVINO_OP("Iterator", "ov::frontend::tensorflow", InternalOperation);

    Iterator(const std::string& shared_name,
             const std::string& container,
             const std::vector<ov::element::Type>& output_types,
             const std::vector<ov::PartialShape>& output_shapes,
             const std::shared_ptr<DecoderBase>& decoder = nullptr)
        : InternalOperation(decoder, OutputVector{}, 1, "Iterator"),
          m_shared_name(shared_name),
          m_container(container),
          m_output_types(output_types),
          m_output_shapes(output_shapes) {
        validate_and_infer_types();
    }

    void validate_and_infer_types() override {
        set_output_type(0, ov::element::dynamic, ov::PartialShape::dynamic());
    }

    std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& inputs) const override {
        auto iterator_node =
            std::make_shared<Iterator>(m_shared_name, m_container, m_output_types, m_output_shapes, m_decoder);
        iterator_node->set_attrs(get_attrs());
        return iterator_node;
    }

private:
    const std::string m_shared_name;
    const std::string m_container;
    const std::vector<ov::element::Type> m_output_types;
    const std::vector<ov::PartialShape> m_output_shapes;
};

}  // namespace ov::frontend::tensorflow