Skip to content

Commit 860edcd

Browse files
yf225vincentqb
authored andcommitted
Change Tensor.data<T> to Tensor.data_ptr<T> (#261)
1 parent 8528ac7 commit 860edcd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

torchaudio/torch_sox.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int64_t write_audio(SoxDescriptor& fd, at::Tensor tensor) {
3737
std::vector<sox_sample_t> buffer(tensor.numel());
3838

3939
AT_DISPATCH_ALL_TYPES(tensor.type(), "write_audio_buffer", [&] {
40-
auto* data = tensor.data<scalar_t>();
40+
auto* data = tensor.data_ptr<scalar_t>();
4141
std::copy(data, data + tensor.numel(), buffer.begin());
4242
});
4343

@@ -64,7 +64,7 @@ void read_audio(
6464
output = output.contiguous();
6565

6666
AT_DISPATCH_ALL_TYPES(output.type(), "read_audio_buffer", [&] {
67-
auto* data = output.data<scalar_t>();
67+
auto* data = output.data_ptr<scalar_t>();
6868
std::copy(buffer.begin(), buffer.begin() + samples_read, data);
6969
});
7070
}
@@ -370,7 +370,7 @@ int build_flow_effects(const std::string& file_name,
370370
const int64_t samples_read = sox_read(input, samples.data(), buffer_size);
371371
assert(samples_read != nc * ns && samples_read != 0);
372372
AT_DISPATCH_ALL_TYPES(otensor.type(), "effects_buffer", [&] {
373-
auto* data = otensor.data<scalar_t>();
373+
auto* data = otensor.data_ptr<scalar_t>();
374374
std::copy(samples.begin(), samples.begin() + samples_read, data);
375375
});
376376
// free buffer and close mem_read

0 commit comments

Comments
 (0)