mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
Fix ConstShapeOp::inferReturnTypes to be resilient to lack of properties
The Python bindings test aren't using properties yet, this is a bit of a hack to support this here, but hopefully it'll be temporary.
This commit is contained in:
@@ -921,7 +921,13 @@ LogicalResult mlir::shape::ConstShapeOp::inferReturnTypes(
|
||||
SmallVectorImpl<Type> &inferredReturnTypes) {
|
||||
Builder b(context);
|
||||
Properties *prop = properties.as<Properties *>();
|
||||
DenseIntElementsAttr shape = prop->shape;
|
||||
DenseIntElementsAttr shape;
|
||||
// TODO: this is only exercised by the Python bindings codepath which does not
|
||||
// support properties
|
||||
if (prop)
|
||||
shape = prop->shape;
|
||||
else
|
||||
shape = attributes.getAs<DenseIntElementsAttr>("shape");
|
||||
if (!shape)
|
||||
return emitOptionalError(location, "missing shape attribute");
|
||||
inferredReturnTypes.assign({RankedTensorType::get(
|
||||
|
||||
Reference in New Issue
Block a user