mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
prevent object destruction compile error (#16134)
### Description The proposed fix is to store the result of AsBlockSparse() in a variable to ensure the object isn't destroyed until the end of the current scope. ### Motivation and Context "own_buffer_tensor" is a temporary object that is destroyed at the end of the expression and causes a compile error.
This commit is contained in:
parent
6b5b79872b
commit
2e66bc8669
1 changed files with 6 additions and 3 deletions
|
|
@ -1815,7 +1815,8 @@ TEST(SparseTensorConversionTests, BlockSparse) {
|
|||
ASSERT_EQ(data_blocks.size(), data_span.size());
|
||||
ASSERT_TRUE(std::equal(data_blocks.cbegin(), data_blocks.cend(), data_span.begin(), data_span.end()));
|
||||
|
||||
const auto& indices = own_buffer_tensor.AsBlockSparse().Indices();
|
||||
auto block_sparse = own_buffer_tensor.AsBlockSparse();
|
||||
const auto& indices = block_sparse.Indices();
|
||||
ASSERT_EQ(indices_shape, indices.Shape());
|
||||
auto indices_span = indices.DataAsSpan<int32_t>();
|
||||
ASSERT_TRUE(std::equal(blocksparse_indices.cbegin(), blocksparse_indices.cend(),
|
||||
|
|
@ -1834,7 +1835,8 @@ TEST(SparseTensorConversionTests, BlockSparse) {
|
|||
ASSERT_EQ(data_blocks.size(), data_span.size());
|
||||
ASSERT_TRUE(std::equal(data_blocks.cbegin(), data_blocks.cend(), data_span.begin(), data_span.end()));
|
||||
|
||||
const auto& indices = user_buffer_tensor.AsBlockSparse().Indices();
|
||||
auto block_sparse = user_buffer_tensor.AsBlockSparse();
|
||||
const auto& indices = block_sparse.Indices();
|
||||
ASSERT_EQ(indices_shape, indices.Shape());
|
||||
auto indices_span = indices.DataAsSpan<int32_t>();
|
||||
ASSERT_TRUE(std::equal(blocksparse_indices.cbegin(), blocksparse_indices.cend(),
|
||||
|
|
@ -1855,7 +1857,8 @@ TEST(SparseTensorConversionTests, BlockSparse) {
|
|||
ASSERT_EQ(expected_span.size(), data_span.size());
|
||||
ASSERT_TRUE(std::equal(expected_span.begin(), expected_span.end(), data_span.begin(), data_span.end()));
|
||||
|
||||
const auto& indices = own_buffer_tensor.AsBlockSparse().Indices();
|
||||
auto block_sparse = own_buffer_tensor.AsBlockSparse();
|
||||
const auto& indices = block_sparse.Indices();
|
||||
ASSERT_EQ(indices_shape, indices.Shape());
|
||||
auto indices_span = indices.DataAsSpan<int32_t>();
|
||||
ASSERT_TRUE(std::equal(blocksparse_indices.cbegin(), blocksparse_indices.cend(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue