[MLIR][MHLO] Implement shape reification for `dynamic_broadcast_in_dim`
PiperOrigin-RevId: 363622714
This commit is contained in:
parent
aad6d39952
commit
0c4a89e52c
|
@ -825,8 +825,9 @@ def HLO_BroadcastInDimOp : HLO_Op<"broadcast_in_dim",
|
|||
let hasCustomHLOConverter = 1;
|
||||
}
|
||||
|
||||
def HLO_DynamicBroadcastInDimOp : HLO_Op<"dynamic_broadcast_in_dim",
|
||||
[NoSideEffect]> {
|
||||
def HLO_DynamicBroadcastInDimOp : HLO_Op<"dynamic_broadcast_in_dim", [
|
||||
NoSideEffect, DeclareOpInterfaceMethods<InferShapedTypeOpInterface,
|
||||
["reifyReturnTypeShapes"]>]> {
|
||||
string summary = "Broadcast a tensor into the given dynamic shape by adding dimensions.";
|
||||
string description = [{
|
||||
This is a generalization of the BroadcastInDimOp which accepts its output
|
||||
|
|
|
@ -908,6 +908,18 @@ void DynamicBroadcastInDimOp::getCanonicalizationPatterns(
|
|||
context);
|
||||
}
|
||||
|
||||
LogicalResult DynamicBroadcastInDimOp::inferReturnTypeComponents(
|
||||
MLIRContext*, llvm::Optional<mlir::Location>, ValueRange, DictionaryAttr,
|
||||
RegionRange, llvm::SmallVectorImpl<mlir::ShapedTypeComponents>&) {
|
||||
return failure();
|
||||
}
|
||||
|
||||
LogicalResult DynamicBroadcastInDimOp::reifyReturnTypeShapes(
|
||||
OpBuilder&, SmallVectorImpl<Value>& reifiedReturnShapes) {
|
||||
reifiedReturnShapes.push_back(output_dimensions());
|
||||
return success();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ClampOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue