Skip to content

Commit

Permalink
Fixed floor_divide deprecation warnings seen in pytest output (pytorc…
Browse files Browse the repository at this point in the history
…h#1455)

* Fixed floor_divide deprecation warnings seen in pytest output

* Fixed warning in test_flanger_triangle_linear
  • Loading branch information
prabhat00155 authored and Caroline Chen committed Apr 30, 2021
1 parent 95ab342 commit fcfa07a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/torchaudio_unittest/functional/functional_cpu_test.py
Expand Up @@ -199,7 +199,8 @@ def test_mask_along_axis(self, shape, mask_param, mask_value, axis):

masked_columns = (mask_specgram == mask_value).sum(other_axis)
num_masked_columns = (masked_columns == mask_specgram.size(other_axis)).sum()
num_masked_columns //= mask_specgram.size(0)
num_masked_columns = torch.div(
num_masked_columns, mask_specgram.size(0), rounding_mode='floor')

assert mask_specgram.size() == specgram.size()
assert num_masked_columns < mask_param
Expand Down
2 changes: 1 addition & 1 deletion torchaudio/functional/filtering.py
Expand Up @@ -46,7 +46,7 @@ def _generate_wave_table(
d = (torch.sin(point.to(torch.float64) / table_size * 2 * math.pi) + 1) / 2
elif wave_type == "TRIANGLE":
d = point.to(torch.float64) * 2 / table_size
value = 4 * point // table_size
value = torch.div(4 * point, table_size, rounding_mode='floor')
d[value == 0] = d[value == 0] + 0.5
d[value == 1] = 1.5 - d[value == 1]
d[value == 2] = 1.5 - d[value == 2]
Expand Down

0 comments on commit fcfa07a

Please sign in to comment.