#include "GraphBuilderRegistry.h"
#include "Transforms.h"
+#include "Annotations/ShapeInferenceData.h"
+
+#include <moco/Log.h>
+
#include <loco/IR/Verifier.h>
#include <cwrap/Fildes.h>
#include <stdex/Memory.h>
assert(loco::valid(graph));
}
+void dump_shapeinferencedata(loco::Node *node, const std::string &name)
+{
+ LOGGER(node_shapeinferencedata);
+
+ const moco::tf::ShapeInferenceData *shapedata = node->annot<moco::tf::ShapeInferenceData>();
+ if (shapedata == nullptr)
+ {
+ INFO(node_shapeinferencedata) << "ShapeInferenceData is null for " << name << ":" << node
+ << std::endl;
+ }
+ else
+ {
+ std::stringstream ss;
+
+ ss << "ShapeInferenceData for " << name << ":" << node;
+ ss << " rank(" << shapedata->rank() << ") [";
+ for (uint32_t index = 0; index < shapedata->rank(); ++index)
+ {
+ if (index)
+ ss << ",";
+ if (shapedata->dim(index).known())
+ ss << shapedata->dim(index).value();
+ else
+ ss << "?";
+ }
+ ss << "]";
+
+ INFO(node_shapeinferencedata) << ss.str() << std::endl;
+ }
+}
+
void transform_graph(loco::Graph *graph)
{
std::vector<std::unique_ptr<moco::tf::Transform>> prepare;
} while (changed);
+ // TODO would be better to run this code only when log is enabled
+ {
+ for (uint32_t i = 0; i < graph->outputs()->size(); ++i)
+ {
+ loco::Node *node = graph->outputs()->at(i)->node();
+ std::string name = "Output(" + std::to_string(i) + ")";
+ dump_shapeinferencedata(node, name);
+ }
+ }
+
// Run finalize to cleanup temporary annotations
for (auto &tr : finalize)
{