#include <algorithm>
#include <bitset>
+#include <sstream>
#include "util/logging.h"
#include "verifier/Verifier.h"
if (::neurun::util::logging::ctx.enabled() == false)
return;
+ std::map<uint32_t, std::string> dumps;
+
_model->operands.iterate([&](const model::OperandIndex &index, model::Operand &object) {
- // Dump operand LowerInfo
- // TODO Extract this dumping procedure to be reusable
+ std::stringstream sstream;
if (!getLowerInfo(index)->def_factors().empty() || !getLowerInfo(index)->use_factors().empty())
{
auto factors_to_string = [](const operand::PermuteFactorSet &factors) {
std::string use_ops = operation_index_to_string(object.getUses());
std::string def_layouts = factors_to_string(lower_info->def_factors());
std::string use_layouts = factors_to_string(lower_info->use_factors());
- VERBOSE(Lower) << "* Operand #" << index.value() << " LowerInfo" << std::endl;
- VERBOSE(Lower) << " - Shape : { " << (shape.rank() > 0 ? shape.dim(0) : 0) << " "
- << (shape.rank() > 1 ? shape.dim(1) : 0) << " "
- << (shape.rank() > 2 ? shape.dim(2) : 0) << " "
- << (shape.rank() > 3 ? shape.dim(3) : 0) << " "
- << "}" << std::endl;
- VERBOSE(Lower) << " - Def Operations : " << def_ops << std::endl;
- VERBOSE(Lower) << " - Use Operations : " << use_ops << std::endl;
- VERBOSE(Lower) << " - Lower Info" << std::endl;
- VERBOSE(Lower) << " - 4D Shape (NHWC) : { " << lower_shape.n() << " " << lower_shape.h()
- << " " << lower_shape.w() << " " << lower_shape.c() << " "
- << "}" << std::endl;
- VERBOSE(Lower) << " - Def Backends : " << def_layouts << std::endl;
- VERBOSE(Lower) << " - Use Backends : " << use_layouts << std::endl;
+ sstream << "Operand #" << index.value() << " LowerInfo" << std::endl;
+ sstream << " - Shape : { " << (shape.rank() > 0 ? shape.dim(0) : 0) << " "
+ << (shape.rank() > 1 ? shape.dim(1) : 0) << " "
+ << (shape.rank() > 2 ? shape.dim(2) : 0) << " "
+ << (shape.rank() > 3 ? shape.dim(3) : 0) << " "
+ << "}" << std::endl;
+ sstream << " - Def Operations : " << def_ops << std::endl;
+ sstream << " - Use Operations : " << use_ops << std::endl;
+ sstream << " - Lower Info" << std::endl;
+ sstream << " - 4D Shape (NHWC) : { " << lower_shape.n() << " " << lower_shape.h() << " "
+ << lower_shape.w() << " " << lower_shape.c() << " "
+ << "}" << std::endl;
+ sstream << " - Def Backends : " << def_layouts << std::endl;
+ sstream << " - Use Backends : " << use_layouts << std::endl;
}
+ dumps.emplace(index.value(), sstream.str());
});
+
+ for (const auto &e : dumps)
+ {
+ if (!e.second.empty())
+ {
+ VERBOSE(Lower) << e.second;
+ }
+ }
}
bool Graph::mergeable(const model::SubgraphIndex &subg_index,