in lib/core_runtime/op_attrs.cc [33:87]
OpAttrType GetOpAttrTypeFromDType(DType kind) {
// TODO(tfrt-devs): Unify BEFAttributeType, OpAttrType and tfrt::DType.
switch (kind) {
case DType::I1:
return OpAttrType::BOOL;
case DType::I8:
return OpAttrType::I8;
case DType::I16:
return OpAttrType::I16;
case DType::I32:
return OpAttrType::I32;
case DType::I64:
return OpAttrType::I64;
case DType::UI8:
return OpAttrType::UI8;
case DType::UI16:
return OpAttrType::UI16;
case DType::UI32:
return OpAttrType::UI32;
case DType::UI64:
return OpAttrType::UI64;
case DType::BF16:
return OpAttrType::BF16;
case DType::F16:
return OpAttrType::F16;
case DType::F32:
return OpAttrType::F32;
case DType::F64:
return OpAttrType::F64;
case DType::Complex64:
return OpAttrType::COMPLEX64;
case DType::Complex128:
return OpAttrType::COMPLEX128;
case DType::String:
return OpAttrType::CHAR;
case DType::Resource:
return OpAttrType::UNSUPPORTED_RESOURCE;
case DType::Variant:
return OpAttrType::UNSUPPORTED_VARIANT;
case DType::QUI8:
return OpAttrType::UNSUPPORTED_QUI8;
case DType::QUI16:
return OpAttrType::UNSUPPORTED_QUI16;
case DType::QI8:
return OpAttrType::UNSUPPORTED_QI8;
case DType::QI16:
return OpAttrType::UNSUPPORTED_QI16;
case DType::QI32:
return OpAttrType::UNSUPPORTED_QI32;
default:
break;
}
llvm_unreachable("unsupported DType in Core Runtime.");
}