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(),
|
return IntegerType::get(context, integerType.getWidth(),
|
||||||
IntegerType::Signless);
|
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 {
|
TensorType ValueTensorType::toBuiltinTensor() const {
|
||||||
|
@ -271,8 +274,10 @@ TensorType ValueTensorType::toBuiltinTensor() const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (!hasSizes())
|
if (!hasSizes())
|
||||||
return UnrankedTensorType::get(getDtype());
|
return UnrankedTensorType::get(getDtype());
|
||||||
return RankedTensorType::get(
|
Type elementType = convertDtypeToBuiltinElementType(getContext(), getDtype());
|
||||||
getSizes(), convertDtypeToBuiltinElementType(getContext(), getDtype()));
|
if (!elementType)
|
||||||
|
return nullptr;
|
||||||
|
return RankedTensorType::get(getSizes(), elementType);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogicalResult
|
LogicalResult
|
||||||
|
|
Loading…
Reference in New Issue