tensorflow/lite/tools/list_flex_ops.cc
// Find the class name of the op kernel described in the node_def from the pool
// of registered ops. If no kernel class is found, return an empty string.
Find the class name of the op kernel described in the node_def from the pool
of registered ops. If no kernel class is found, return an empty string.
Find the class name of the op kernel described in the node_def from the pool of registered ops . If no kernel class is found return an empty string .
string FindTensorflowKernelClass(tensorflow::NodeDef* node_def) {
  if (!node_def || node_def->op().empty()) {
    LOG(FATAL) << "Invalid NodeDef";
  }
  const tensorflow::OpRegistrationData* op_reg_data;
  auto status =
      tensorflow::OpRegistry::Global()->LookUp(node_def->op(), &op_reg_data);
  if (!status.ok()) {
    LOG(FATAL) << "Op " << node_def->op() << " not found: " << status;
  }
  AddDefaultsToNodeDef(op_reg_data->op_def, node_def);
  tensorflow::DeviceNameUtils::ParsedName parsed_name;
  if (!tensorflow::DeviceNameUtils::ParseFullName(node_def->device(),
                                                  &parsed_name)) {
    LOG(FATAL) << "Failed to parse device from node_def: "
               << node_def->ShortDebugString();
  }
  string class_name;
  if (!tensorflow::FindKernelDef(
           tensorflow::DeviceType(parsed_name.type.c_str()), *node_def,
           nullptr , &class_name)
           .ok()) {
    LOG(FATAL) << "Failed to find kernel class for op: " << node_def->op();
  }
  return class_name;
}
string FindTensorflowKernelClass ( tensorflow :: NodeDef * node_def ) { if ( ! node_def || node_def -> op ( ) . empty ( ) ) { LOG ( FATAL ) << " " ; } const tensorflow :: OpRegistrationData * op_reg_data ; auto status = tensorflow :: OpRegistry :: Global ( ) -> LookUp ( node_def -> op ( ) , & op_reg_data ) ; if ( ! status . ok ( ) ) { LOG ( FATAL ) << " " << node_def -> op ( ) << " " << status ; } AddDefaultsToNodeDef ( op_reg_data -> op_def , node_def ) ; tensorflow :: DeviceNameUtils :: ParsedName parsed_name ; if ( ! tensorflow :: DeviceNameUtils :: ParseFullName ( node_def -> device ( ) , & parsed_name ) ) { LOG ( FATAL ) << " " << node_def -> ShortDebugString ( ) ; } string class_name ; if ( ! tensorflow :: FindKernelDef ( tensorflow :: DeviceType ( parsed_name . type . c_str ( ) ) , * node_def , nullptr , & class_name ) . ok ( ) ) { LOG ( FATAL ) << " " << node_def -> op ( ) ; } return class_name ; }
Find the class name of the op kernel described in the node_def from the pool
of registered ops.
Find the class name of the op kernel described in the node_def from the pool of registered ops .
/* kernel_def */