mirror of
				https://github.com/ml-explore/mlx.git
				synced 2025-10-31 16:21:27 +08:00 
			
		
		
		
	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:
		| @@ -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); | ||||
|   | ||||
| @@ -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}); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Cheng
					Cheng