mirror of https://github.com/llvm/torch-mlir
Emit a proper error.
This assertion was reachable from user code (e.g. !torch.qint8 dtype), which should never be possible for an assertion. Instead, emit a diagnostic.pull/323/head
parent
a99cbeeb7e
commit
12d0fe7c85
|
@ -263,7 +263,10 @@ static Type convertDtypeToBuiltinElementType(MLIRContext *context, Type dtype) {
|
|||
return IntegerType::get(context, integerType.getWidth(),
|
||||
IntegerType::Signless);
|
||||
}
|
||||
assert(false && "Unsupported dtype to convert to builtin element type");
|
||||
emitError(UnknownLoc::get(context))
|
||||
<< "unimplemented: conversion of dtype " << dtype
|
||||
<< " to builtin tensor element type";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TensorType ValueTensorType::toBuiltinTensor() const {
|
||||
|
@ -271,8 +274,10 @@ TensorType ValueTensorType::toBuiltinTensor() const {
|
|||
return nullptr;
|
||||
if (!hasSizes())
|
||||
return UnrankedTensorType::get(getDtype());
|
||||
return RankedTensorType::get(
|
||||
getSizes(), convertDtypeToBuiltinElementType(getContext(), getDtype()));
|
||||
Type elementType = convertDtypeToBuiltinElementType(getContext(), getDtype());
|
||||
if (!elementType)
|
||||
return nullptr;
|
||||
return RankedTensorType::get(getSizes(), elementType);
|
||||
}
|
||||
|
||||
LogicalResult
|
||||
|
|
Loading…
Reference in New Issue