Add more check to sparsity parameter verifier.
PiperOrigin-RevId: 286436553 Change-Id: I43913b2a16ad7bb3b3e22fa65cd47462159b8f67
This commit is contained in:
parent
0c43ecf472
commit
ba91c04e00
@ -179,7 +179,8 @@ absl::optional<uint64_t> VerifyAndCountSparseElements(const Tensor& tensor) {
|
||||
|
||||
const int total_dims = sparsity->traversal_order()->size();
|
||||
|
||||
if (sparsity->dim_metadata()->size() != total_dims) {
|
||||
if (total_dims < tensor.shape()->size() ||
|
||||
sparsity->dim_metadata()->size() != total_dims) {
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user