File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -44,19 +44,16 @@ int64_t create_from_file_like(
4444
4545int64_t encode_audio_to_file_like (
4646 uintptr_t data_ptr,
47- py::list shape,
47+ const std::vector< int64_t >& shape,
4848 int64_t sample_rate,
4949 std::string_view format,
5050 py::object file_like,
5151 std::optional<int64_t > bit_rate = std::nullopt ,
5252 std::optional<int64_t > num_channels = std::nullopt ) {
53- // Convert Python list to vector
54- auto shape_vec = shape.cast <std::vector<int64_t >>();
55-
5653 // Create tensor from existing data pointer (enforcing float32)
5754 auto tensor_options = torch::TensorOptions ().dtype (torch::kFloat32 );
5855 auto samples = torch::from_blob (
59- reinterpret_cast <void *>(data_ptr), shape_vec , tensor_options);
56+ reinterpret_cast <void *>(data_ptr), shape , tensor_options);
6057
6158 AudioStreamOptions audioStreamOptions;
6259 audioStreamOptions.bitRate = bit_rate;
You can’t perform that action at this time.
0 commit comments