From 4c20afca45004628f811a111250b5c7a715a32cf Mon Sep 17 00:00:00 2001 From: David Wendt Date: Wed, 26 Jan 2022 11:22:28 -0500 Subject: [PATCH] grab size before calling release() --- cpp/src/text/subword/load_hash_file.cu | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/cpp/src/text/subword/load_hash_file.cu b/cpp/src/text/subword/load_hash_file.cu index bde1def6e00..7cfdb4dea96 100644 --- a/cpp/src/text/subword/load_hash_file.cu +++ b/cpp/src/text/subword/load_hash_file.cu @@ -262,17 +262,15 @@ std::unique_ptr load_vocabulary_file( cudaMemcpyHostToDevice, stream.value())); - auto cp_metadata = detail::get_codepoint_metadata(stream); - result.cp_metadata = - std::make_unique(cudf::data_type{cudf::type_id::UINT32}, - static_cast(cp_metadata.size()), - cp_metadata.release()); - - auto aux_cp_table = detail::get_aux_codepoint_data(stream); - result.aux_cp_table = - std::make_unique(cudf::data_type{cudf::type_id::UINT64}, - static_cast(aux_cp_table.size()), - aux_cp_table.release()); + auto cp_metadata = detail::get_codepoint_metadata(stream); + auto const cp_metadata_size = static_cast(cp_metadata.size()); + result.cp_metadata = std::make_unique( + cudf::data_type{cudf::type_id::UINT32}, cp_metadata_size, cp_metadata.release()); + + auto aux_cp_table = detail::get_aux_codepoint_data(stream); + auto const aux_cp_table_size = static_cast(aux_cp_table.size()); + result.aux_cp_table = std::make_unique( + cudf::data_type{cudf::type_id::UINT64}, aux_cp_table_size, aux_cp_table.release()); return std::make_unique(std::move(result)); }