#include "moco/IR/TFNode.h"
#include <loco/IR/Graph.h>
+#include <loco/IR/GraphInputIndex.h>
#include <loco/IR/GraphOutputIndex.h>
#include <stdex/Memory.h>
namespace
{
+struct GiiQueryServiceImpl final : public loco::GraphInputIndexQueryService
+{
+ bool associated(const loco::Node *node) const final
+ {
+ if (auto tfplaceholder = dynamic_cast<const moco::TFPlaceholder *>(node))
+ {
+ return moco::indexed(tfplaceholder);
+ }
+ return false;
+ }
+
+ loco::GraphOutputIndex index(const loco::Node *node) const final
+ {
+ assert(associated(node));
+ auto tfplaceholder = dynamic_cast<const moco::TFPlaceholder *>(node);
+ assert(tfplaceholder != nullptr);
+ return moco::index(tfplaceholder);
+ }
+};
+
struct GoiQueryServiceImpl final : public loco::GraphOutputIndexQueryService
{
bool associated(const loco::Node *node) const final
TFDialect::TFDialect()
{
+ service<loco::GraphInputIndexQueryService>(stdex::make_unique<GiiQueryServiceImpl>());
service<loco::GraphOutputIndexQueryService>(stdex::make_unique<GoiQueryServiceImpl>());
}