Skip to content
11 changes: 11 additions & 0 deletions paddle/phi/kernels/funcs/slice_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@ limitations under the License. */
namespace phi {

namespace funcs {
inline bool CheckIsLastDimsMatch(const DDim& first, const DDim& second) {
auto n1 = first.size();
auto n2 = second.size();
size_t min_len = std::min(n1, n2);

for (size_t i = 0; i < min_len; i++) {
if (first[n1 - 1 - i] != second[n2 - 1 - i]) {
return false;
}
}
return true;
}
// check whether the tensor with dimension of second can assign to the
// tensor with dimension of first
inline bool CheckIsDimsMatchBool(const DDim& first, const DDim& second) {
Expand Down
Loading