cinn/hlir/framework/graph_compiler.cc
// Store params from node to instruction
Store params from node to instruction
Store params from node to instruction
void AddAttrs(const absl::flat_hash_map<std::string, AttrType>& attrs_store,
              const std::vector<std::string>& attrs_name,
              Instruction* instr) {
  for (auto& attr : attrs_name) {
    if (attrs_store.find(attr) != attrs_store.end()) {
      switch (attrs_store.at(attr).index()) {
        case 2:
          instr->attrs.push_back(absl::get<int>(attrs_store.at(attr)));
          break;
        case 3:
          instr->str_attrs.push_back(absl::get<std::string>(attrs_store.at(attr)));
          break;
        case 5:
          auto temp = absl::get<std::vector<int>>(attrs_store.at(attr));
          instr->attrs.insert(instr->attrs.end(), temp.begin(), temp.end());
          break;
      }
    } else {
      LOG(ERROR) << "Param " << attr << " missed! Please check.";
    }
  }
}
void AddAttrs ( const absl :: flat_hash_map < std :: string , AttrType > & attrs_store , const std :: vector < std :: string > & attrs_name , Instruction * instr ) { for ( auto & attr : attrs_name ) { if ( attrs_store . find ( attr ) != attrs_store . end ( ) ) { switch ( attrs_store . at ( attr ) . index ( ) ) { case 2 : instr -> attrs . push_back ( absl :: get < int > ( attrs_store . at ( attr ) ) ) ; break ; case 3 : instr -> str_attrs . push_back ( absl :: get < std :: string > ( attrs_store . at ( attr ) ) ) ; break ; case 5 : auto temp = absl :: get < std :: vector < int > > ( attrs_store . at ( attr ) ) ; instr -> attrs . insert ( instr -> attrs . end ( ) , temp . begin ( ) , temp . end ( ) ) ; break ; } } else { LOG ( ERROR ) << " " << attr << " " ; } } }
Store params from node to instruction
Store params from node to instruction