File tree 2 files changed +13
-14
lines changed
paddle/fluid/pir/dialect/operator
2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -3588,13 +3588,12 @@ std::vector<pir::Type> ExpandOp::InferMeta(
3588
3588
.dyn_cast <paddle::dialect::IntArrayAttribute>()
3589
3589
.data ()
3590
3590
.GetData ();
3591
- PADDLE_ENFORCE_LE (shape_vec.size (),
3592
- 1 ,
3593
- common::errors::InvalidArgument (
3594
- " The size of shape for Full op should be less than "
3595
- " or equal to 1, but receive %d." ,
3596
- shape_vec.size ()));
3597
- auto items = shape_vec.empty () ? 1 : shape_vec[0 ];
3591
+ // TODO(ooooo): If can make sure shape_value's size is less than or equal
3592
+ // to 1, can add a check here rather than product.
3593
+ int64_t items = 1 ;
3594
+ for (const auto &item : shape_vec) {
3595
+ items *= item;
3596
+ }
3598
3597
vec_shape = std::vector<int64_t >(items, shape_item);
3599
3598
} else if (shape.isa <pir::OpResult>() &&
3600
3599
shape.defining_op ()->isa <paddle::dialect::StackOp>()) {
Original file line number Diff line number Diff line change 13
13
// limitations under the License.
14
14
15
15
#include < glog/logging.h>
16
+ #include < cstdint>
16
17
#include < sstream>
17
18
#include < unordered_set>
18
19
@@ -432,13 +433,12 @@ std::vector<int64_t> ParseValueShape(const pir::Value& shape,
432
433
.dyn_cast <paddle::dialect::IntArrayAttribute>()
433
434
.data ()
434
435
.GetData ();
435
- PADDLE_ENFORCE_LE (shape_vec.size (),
436
- 1 ,
437
- common::errors::InvalidArgument (
438
- " The size of shape for Full op should be less than "
439
- " or equal to 1, but receive %d." ,
440
- shape_vec.size ()));
441
- auto items = shape_vec.empty () ? 1 : shape_vec[0 ];
436
+ // TODO(ooooo): If can make sure shape_value's size is less than or equal
437
+ // to 1, can add a check here rather than product.
438
+ int64_t items = 1 ;
439
+ for (const auto & item : shape_vec) {
440
+ items *= item;
441
+ }
442
442
vec_shape = std::vector<int64_t >(items, shape_item);
443
443
} else if (shape.isa <pir::OpResult>() &&
444
444
shape.defining_op ()->isa <paddle::dialect::StackOp>()) {
You can’t perform that action at this time.
0 commit comments