Returns whether if `type1` dimensions are the same as the ending dimensions of `type2`. This is more restricted than broadcastable.
| 86 | // Returns whether if `type1` dimensions are the same as the ending dimensions |
| 87 | // of `type2`. This is more restricted than broadcastable. |
| 88 | bool IsTailOfShape(Type type1, Type type2) { |
| 89 | auto tail_type = type1.dyn_cast<ShapedType>(); |
| 90 | auto full_type = type2.dyn_cast<ShapedType>(); |
| 91 | if (!tail_type || !full_type || tail_type.getRank() > full_type.getRank()) |
| 92 | return false; |
| 93 | auto i1 = tail_type.getShape().rbegin(), e1 = tail_type.getShape().rend(); |
| 94 | auto i2 = full_type.getShape().rbegin(); |
| 95 | return std::equal(i1, e1, i2); |
| 96 | } |
| 97 | |
| 98 | bool CanFuseConvOrDepthwiseConvShapes(const ArrayRef<int64_t> filter_shape, |
| 99 | const ArrayRef<int64_t> elements_shape, |