MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / IsTailOfShape

Function IsTailOfShape

tensorflow/compiler/mlir/lite/transforms/optimize.cc:88–96  ·  view source on GitHub ↗

Returns whether if `type1` dimensions are the same as the ending dimensions of `type2`. This is more restricted than broadcastable.

Source from the content-addressed store, hash-verified

86// Returns whether if `type1` dimensions are the same as the ending dimensions
87// of `type2`. This is more restricted than broadcastable.
88bool 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
98bool CanFuseConvOrDepthwiseConvShapes(const ArrayRef<int64_t> filter_shape,
99 const ArrayRef<int64_t> elements_shape,

Callers

nothing calls this directly

Calls 3

rbeginMethod · 0.80
rendMethod · 0.80
equalFunction · 0.50

Tested by

no test coverage detected