Commit 44b92062 authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Ensure StreamReader returns tensors with requires_grad is False (#3467)

Summary: Pull Request resolved: https://github.com/pytorch/audio/pull/3467

Differential Revision: D47482388

Pulled By: mthrok

fbshipit-source-id: abff36491dc28b83270673860d6457a084b1327d
parent ea7a96dd
...@@ -534,6 +534,16 @@ class StreamReaderInterfaceTest(_MediaSourceMixin, TempDirMixin, TorchaudioTestC ...@@ -534,6 +534,16 @@ class StreamReaderInterfaceTest(_MediaSourceMixin, TempDirMixin, TorchaudioTestC
if i >= 40: if i >= 40:
break break
def test_stream_requires_grad_false(self):
"""Tensors produced by StreamReader are requires_grad=False"""
s = StreamReader(self.get_src())
s.add_basic_audio_stream(frames_per_chunk=2000)
s.add_basic_video_stream(frames_per_chunk=15)
s.fill_buffer()
audio, video = s.pop_chunks()
assert not audio._elem.requires_grad
assert not video._elem.requires_grad
@parameterized.expand(["key", "any", "precise"]) @parameterized.expand(["key", "any", "precise"])
def test_seek(self, mode): def test_seek(self, mode):
"""Calling `seek` multiple times should not segfault""" """Calling `seek` multiple times should not segfault"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment