Skip to content

Commit e041abc

Browse files
committed
updated variables in python files
1 parent 09b3b98 commit e041abc

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/torchcodec/_core/ops.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,9 @@ def create_from_file_abstract(filename: str, seek_mode: Optional[str]) -> torch.
161161
return torch.empty([], dtype=torch.long)
162162

163163

164-
# TODO-ENCODING: rename wf to samples
165164
@register_fake("torchcodec_ns::encode_audio_to_file")
166165
def encode_audio_to_file_abstract(
167-
wf: torch.Tensor,
166+
samples: torch.Tensor,
168167
sample_rate: int,
169168
filename: str,
170169
bit_rate: Optional[int] = None,
@@ -175,7 +174,7 @@ def encode_audio_to_file_abstract(
175174

176175
@register_fake("torchcodec_ns::encode_audio_to_tensor")
177176
def encode_audio_to_tensor_abstract(
178-
wf: torch.Tensor,
177+
samples: torch.Tensor,
179178
sample_rate: int,
180179
format: str,
181180
bit_rate: Optional[int] = None,

src/torchcodec/encoders/_audio_encoder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def to_file(
3434
num_channels: Optional[int] = None,
3535
) -> None:
3636
_core.encode_audio_to_file(
37-
wf=self._samples,
37+
samples=self._samples,
3838
sample_rate=self._sample_rate,
3939
filename=dest,
4040
bit_rate=bit_rate,
@@ -49,7 +49,7 @@ def to_tensor(
4949
num_channels: Optional[int] = None,
5050
) -> Tensor:
5151
return _core.encode_audio_to_tensor(
52-
wf=self._samples,
52+
samples=self._samples,
5353
sample_rate=self._sample_rate,
5454
format=format,
5555
bit_rate=bit_rate,

test/test_ops.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,22 +1101,24 @@ def test_bad_input(self, tmp_path):
11011101

11021102
with pytest.raises(RuntimeError, match="must have float32 dtype, got int"):
11031103
encode_audio_to_file(
1104-
wf=torch.arange(10, dtype=torch.int),
1104+
samples=torch.arange(10, dtype=torch.int),
11051105
sample_rate=10,
11061106
filename=valid_output_file,
11071107
)
11081108
with pytest.raises(RuntimeError, match="must have 2 dimensions, got 1"):
11091109
encode_audio_to_file(
1110-
wf=torch.rand(3), sample_rate=10, filename=valid_output_file
1110+
samples=torch.rand(3), sample_rate=10, filename=valid_output_file
11111111
)
11121112

11131113
with pytest.raises(RuntimeError, match="No such file or directory"):
11141114
encode_audio_to_file(
1115-
wf=torch.rand(2, 10), sample_rate=10, filename="./bad/path.mp3"
1115+
samples=torch.rand(2, 10), sample_rate=10, filename="./bad/path.mp3"
11161116
)
11171117
with pytest.raises(RuntimeError, match="check the desired extension"):
11181118
encode_audio_to_file(
1119-
wf=torch.rand(2, 10), sample_rate=10, filename="./file.bad_extension"
1119+
samples=torch.rand(2, 10),
1120+
sample_rate=10,
1121+
filename="./file.bad_extension",
11201122
)
11211123

11221124

0 commit comments

Comments
 (0)