Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
860edcdb
"doc/git@developer.sourcefind.cn:OpenDAS/ktransformers.git" did not exist on "395cd3e78656fdaf35f1feb088f9888af660dddf"
Commit
860edcdb
authored
Aug 29, 2019
by
Will Feng
Committed by
Vincent QB
Aug 29, 2019
Browse files
Change Tensor.data<T> to Tensor.data_ptr<T> (#261)
parent
8528ac78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
torchaudio/torch_sox.cpp
torchaudio/torch_sox.cpp
+3
-3
No files found.
torchaudio/torch_sox.cpp
View file @
860edcdb
...
@@ -37,7 +37,7 @@ int64_t write_audio(SoxDescriptor& fd, at::Tensor tensor) {
...
@@ -37,7 +37,7 @@ int64_t write_audio(SoxDescriptor& fd, at::Tensor tensor) {
std
::
vector
<
sox_sample_t
>
buffer
(
tensor
.
numel
());
std
::
vector
<
sox_sample_t
>
buffer
(
tensor
.
numel
());
AT_DISPATCH_ALL_TYPES
(
tensor
.
type
(),
"write_audio_buffer"
,
[
&
]
{
AT_DISPATCH_ALL_TYPES
(
tensor
.
type
(),
"write_audio_buffer"
,
[
&
]
{
auto
*
data
=
tensor
.
data
<
scalar_t
>
();
auto
*
data
=
tensor
.
data
_ptr
<
scalar_t
>
();
std
::
copy
(
data
,
data
+
tensor
.
numel
(),
buffer
.
begin
());
std
::
copy
(
data
,
data
+
tensor
.
numel
(),
buffer
.
begin
());
});
});
...
@@ -64,7 +64,7 @@ void read_audio(
...
@@ -64,7 +64,7 @@ void read_audio(
output
=
output
.
contiguous
();
output
=
output
.
contiguous
();
AT_DISPATCH_ALL_TYPES
(
output
.
type
(),
"read_audio_buffer"
,
[
&
]
{
AT_DISPATCH_ALL_TYPES
(
output
.
type
(),
"read_audio_buffer"
,
[
&
]
{
auto
*
data
=
output
.
data
<
scalar_t
>
();
auto
*
data
=
output
.
data
_ptr
<
scalar_t
>
();
std
::
copy
(
buffer
.
begin
(),
buffer
.
begin
()
+
samples_read
,
data
);
std
::
copy
(
buffer
.
begin
(),
buffer
.
begin
()
+
samples_read
,
data
);
});
});
}
}
...
@@ -370,7 +370,7 @@ int build_flow_effects(const std::string& file_name,
...
@@ -370,7 +370,7 @@ int build_flow_effects(const std::string& file_name,
const
int64_t
samples_read
=
sox_read
(
input
,
samples
.
data
(),
buffer_size
);
const
int64_t
samples_read
=
sox_read
(
input
,
samples
.
data
(),
buffer_size
);
assert
(
samples_read
!=
nc
*
ns
&&
samples_read
!=
0
);
assert
(
samples_read
!=
nc
*
ns
&&
samples_read
!=
0
);
AT_DISPATCH_ALL_TYPES
(
otensor
.
type
(),
"effects_buffer"
,
[
&
]
{
AT_DISPATCH_ALL_TYPES
(
otensor
.
type
(),
"effects_buffer"
,
[
&
]
{
auto
*
data
=
otensor
.
data
<
scalar_t
>
();
auto
*
data
=
otensor
.
data
_ptr
<
scalar_t
>
();
std
::
copy
(
samples
.
begin
(),
samples
.
begin
()
+
samples_read
,
data
);
std
::
copy
(
samples
.
begin
(),
samples
.
begin
()
+
samples_read
,
data
);
});
});
// free buffer and close mem_read
// free buffer and close mem_read
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment