Don't use make_unique to create shared_ptr (#902)

The code compiled because shared_ptr's constructor actually accepts
unique_ptr.
This commit is contained in:
Cheng
2024-03-27 22:13:29 +09:00
committed by GitHub
parent dc175f08d3
commit 90dfa43ff1
8 changed files with 17 additions and 17 deletions

View File

@@ -217,7 +217,7 @@ array load(std::shared_ptr<io::Reader> in_stream, StreamOrDevice s) {
auto loaded_array = array(
shape,
dtype,
std::make_unique<Load>(to_stream(s), in_stream, offset, swap_endianness),
std::make_shared<Load>(to_stream(s), in_stream, offset, swap_endianness),
std::vector<array>{});
if (col_contiguous) {
loaded_array = transpose(loaded_array, s);

View File

@@ -136,7 +136,7 @@ SafetensorsLoad load_safetensors(
auto loaded_array = array(
shape,
type,
std::make_unique<Load>(
std::make_shared<Load>(
to_stream(s), in_stream, offset + data_offsets.at(0), false),
std::vector<array>{});
res.insert({item.key(), loaded_array});