Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,28 @@ bool EmbeddingOpInferSymbolicShape(
return true;
}

bool EqualAllOpInferSymbolicShape(
pir::Operation *op, pir::InferSymbolicShapeContext *infer_context) {
const auto &x_dims =
infer_context->GetShapeOrDataForValue(op->operand_source(0)).shape();
const auto &y_dims =
infer_context->GetShapeOrDataForValue(op->operand_source(1)).shape();

PADDLE_ENFORCE_GE(
x_dims.size(),
y_dims.size(),
common::errors::InvalidArgument(
"The size of dim_y should not be greater than dim_x's."));

std::vector<symbol::DimExpr> out_dims =
{}; // Adjust the dimensions as necessary
infer_context->SetShapeOrDataForValue(
op->result(0),
symbol::ShapeOrDataDimExprs{symbol::TensorShapeOrDataDimExprs(out_dims)});

return true;
}

bool SparseWeightEmbeddingOpInferSymbolicShape(
pir::Operation *op, pir::InferSymbolicShapeContext *infer_context) {
PADDLE_THROW(phi::errors::Unimplemented(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ OP_DECLARE_INFER_SYMBOLIC_SHAPE(BceLoss_)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(Conv2d)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(Conv3d)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(Embedding)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(EqualAll)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(SparseWeightEmbedding)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(ExpandAs)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(FillDiagonalTensor)
Expand Down
1 change: 1 addition & 0 deletions paddle/phi/ops/yaml/ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,7 @@
func : CompareAllInferMeta
kernel :
func : equal_all
interfaces : paddle::dialect::InferSymbolicShapeInterface

- op : erf
args : (Tensor x)
Expand Down