Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dcshift to functional #558

Merged
merged 6 commits into from Apr 20, 2020
Merged

Conversation

bhargavkathivarapu
Copy link
Contributor

Hi ,
Regarding the issue #260 ( Reducing dependency in Sox)
Implemented dcshift function in functional.py

..................gain: can't reclaim headroom
.
----------------------------------------------------------------------
Ran 19 tests in 475.924s

OK
  • test_batch_consistency.py - added test for dcshift
.................
----------------------------------------------------------------------
Ran 17 tests in 204.327s

OK
  • test_torchscript_consistency.py - added test but giving error, couldn't understand the issue.
    Below is the log
$ python test/test_torchscript_consistency.py 
.............E...................sssssssssssssssssssssssssssssssss...............sssssssssssssss
======================================================================
ERROR: test_dcshift (__main__.TestFunctionalCPU)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_torchscript_consistency.py", line 428, in test_dcshift
    self._assert_consistency(func, waveform)
  File "test/test_torchscript_consistency.py", line 38, in _assert_consistency
    return _assert_functional_consistency(func, tensor, self.device, shape_only=shape_only)
  File "test/test_torchscript_consistency.py", line 14, in _assert_functional_consistency
    ts_func = torch.jit.script(func)
  File "/Users/bhargav/pytorch/torch/jit/__init__.py", line 1296, in script
    fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj))
  File "/Users/bhargav/pytorch/torch/jit/_recursive.py", line 559, in try_compile_fn
    return torch.jit.script(fn, _rcb=rcb)
  File "/Users/bhargav/pytorch/torch/jit/__init__.py", line 1293, in script
    ast = get_jit_def(obj)
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 173, in get_jit_def
    return build_def(ctx, py_ast.body[0], type_line, self_name)
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 206, in build_def
    build_stmts(ctx, body))
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 129, in build_stmts
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 129, in <listcomp>
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 181, in __call__
    return method(ctx, node)
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 361, in build_If
    build_stmts(ctx, stmt.body),
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 129, in build_stmts
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 129, in <listcomp>
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 181, in __call__
    return method(ctx, node)
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 288, in build_Assign
    rhs = build_expr(ctx, stmt.value)
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 181, in __call__
    return method(ctx, node)
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 457, in build_Call
    kw_expr = build_expr(ctx, kw.value)
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 181, in __call__
    return method(ctx, node)
  File "/Users/bhargav/pytorch/torch/jit/frontend.py", line 517, in build_UnaryOp
    r = ctx.make_range(expr.lineno, expr.col_offset, expr.col_offset + len(op_token))
TypeError: object of type 'NoneType' has no len()

@vincentqb could you please review these changes

torchaudio/functional.py Outdated Show resolved Hide resolved
torchaudio/functional.py Outdated Show resolved Hide resolved
torchaudio/functional.py Outdated Show resolved Hide resolved
torchaudio/functional.py Outdated Show resolved Hide resolved
@mthrok mthrok requested a review from vincentqb April 17, 2020 14:25
torchaudio/functional.py Outdated Show resolved Hide resolved
@mthrok
Copy link
Collaborator

mthrok commented Apr 17, 2020

Can you also add dcshift to __all__ in functional.py?

@mthrok
Copy link
Collaborator

mthrok commented Apr 20, 2020

Looks good to me 🙂

@vincentqb vincentqb merged commit 91e5923 into pytorch:master Apr 20, 2020
@mthrok mthrok mentioned this pull request May 14, 2020
mthrok pushed a commit to mthrok/audio that referenced this pull request Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants