Skip to content

Commit f14a088

Browse files
[mlir][SparseTensor] Fix type conversion rule
1 parent cb78eb0 commit f14a088

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorDescriptor.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ convertSparseTensorType(RankedTensorType rtp, SmallVectorImpl<Type> &fields) {
3838
if (!stt.hasEncoding())
3939
return std::nullopt;
4040

41+
unsigned numFields = fields.size();
4142
foreachFieldAndTypeInSparseTensor(
4243
stt,
43-
[&fields](Type fieldType, FieldIndex fieldIdx,
44-
SparseTensorFieldKind /*fieldKind*/, Level /*lvl*/,
45-
LevelType /*lt*/) -> bool {
46-
assert(fieldIdx == fields.size());
44+
[&](Type fieldType, FieldIndex fieldIdx,
45+
SparseTensorFieldKind /*fieldKind*/, Level /*lvl*/,
46+
LevelType /*lt*/) -> bool {
47+
assert(numFields + fieldIdx == fields.size());
4748
fields.push_back(fieldType);
4849
return true;
4950
});

0 commit comments

Comments
 (0)