diff options
author | Justine Tunney <jart@google.com> | 2016-12-29 22:46:24 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-12-29 23:06:59 -0800 |
commit | e121667dc609de978a223c56ee906368d2c4ceef (patch) | |
tree | 7d4e1f1e1b4fd469487872c0cd34ddace5ac570c /tensorflow/contrib/ffmpeg | |
parent | 7815fcba7767aa1eb3196c5861e174f8b3c43bab (diff) |
Remove so many more hourglass imports
Change: 143230429
Diffstat (limited to 'tensorflow/contrib/ffmpeg')
-rw-r--r-- | tensorflow/contrib/ffmpeg/BUILD | 4 | ||||
-rw-r--r-- | tensorflow/contrib/ffmpeg/decode_audio_op_test.py | 34 | ||||
-rw-r--r-- | tensorflow/contrib/ffmpeg/encode_audio_op_test.py | 16 |
3 files changed, 29 insertions, 25 deletions
diff --git a/tensorflow/contrib/ffmpeg/BUILD b/tensorflow/contrib/ffmpeg/BUILD index 99b69de30c..95d8b74b00 100644 --- a/tensorflow/contrib/ffmpeg/BUILD +++ b/tensorflow/contrib/ffmpeg/BUILD @@ -86,7 +86,7 @@ tf_py_test( srcs = ["decode_audio_op_test.py"], additional_deps = [ ":ffmpeg_ops_py", - "//tensorflow:tensorflow_py", + "//tensorflow/python:client_testlib", "//tensorflow/python:platform", ], data = [ @@ -100,7 +100,7 @@ tf_py_test( srcs = ["encode_audio_op_test.py"], additional_deps = [ ":ffmpeg_ops_py", - "//tensorflow:tensorflow_py", + "//tensorflow/python:client_testlib", "//tensorflow/python:platform", ], data = [ diff --git a/tensorflow/contrib/ffmpeg/decode_audio_op_test.py b/tensorflow/contrib/ffmpeg/decode_audio_op_test.py index 6e85d360cc..e4ed46b1e2 100644 --- a/tensorflow/contrib/ffmpeg/decode_audio_op_test.py +++ b/tensorflow/contrib/ffmpeg/decode_audio_op_test.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================= - """Tests for third_party.tensorflow.contrib.ffmpeg.decode_audio_op.""" from __future__ import absolute_import @@ -21,13 +20,12 @@ from __future__ import print_function import os.path -import tensorflow as tf - from tensorflow.contrib import ffmpeg from tensorflow.python.platform import resource_loader +from tensorflow.python.platform import test -class DecodeAudioOpTest(tf.test.TestCase): +class DecodeAudioOpTest(test.TestCase): def _loadFileAndTest(self, filename, file_format, duration_sec, samples_per_second, channel_count): @@ -41,20 +39,23 @@ class DecodeAudioOpTest(tf.test.TestCase): channel_count: The desired channel count in the output tensor. """ with self.test_session(): - path = os.path.join( - resource_loader.get_data_files_path(), 'testdata', filename) + path = os.path.join(resource_loader.get_data_files_path(), 'testdata', + filename) with open(path, 'rb') as f: contents = f.read() audio_op = ffmpeg.decode_audio( - contents, file_format=file_format, - samples_per_second=samples_per_second, channel_count=channel_count) + contents, + file_format=file_format, + samples_per_second=samples_per_second, + channel_count=channel_count) audio = audio_op.eval() self.assertEqual(len(audio.shape), 2) - self.assertNear(duration_sec * samples_per_second, - audio.shape[0], - # Duration should be specified within 10%: - 0.1 * audio.shape[0]) + self.assertNear( + duration_sec * samples_per_second, + audio.shape[0], + # Duration should be specified within 10%: + 0.1 * audio.shape[0]) self.assertEqual(audio.shape[1], channel_count) def testMonoMp3(self): @@ -95,11 +96,14 @@ class DecodeAudioOpTest(tf.test.TestCase): def testInvalidFile(self): with self.test_session(): contents = 'invalid file' - audio_op = ffmpeg.decode_audio(contents, file_format='wav', - samples_per_second=10000, channel_count=2) + audio_op = ffmpeg.decode_audio( + contents, + file_format='wav', + samples_per_second=10000, + channel_count=2) audio = audio_op.eval() self.assertEqual(audio.shape, (0, 0)) if __name__ == '__main__': - tf.test.main() + test.main() diff --git a/tensorflow/contrib/ffmpeg/encode_audio_op_test.py b/tensorflow/contrib/ffmpeg/encode_audio_op_test.py index 17283a93c3..18d992911d 100644 --- a/tensorflow/contrib/ffmpeg/encode_audio_op_test.py +++ b/tensorflow/contrib/ffmpeg/encode_audio_op_test.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================= - """Tests for third_party.tensorflow.contrib.ffmpeg.encode_audio_op.""" from __future__ import absolute_import @@ -21,13 +20,12 @@ from __future__ import print_function import os.path -import tensorflow as tf - from tensorflow.contrib import ffmpeg from tensorflow.python.platform import resource_loader +from tensorflow.python.platform import test -class EncodeAudioOpTest(tf.test.TestCase): +class EncodeAudioOpTest(test.TestCase): def _compareWavFiles(self, original, encoded): """Compares the important bits of two WAV files. @@ -53,13 +51,15 @@ class EncodeAudioOpTest(tf.test.TestCase): def testRoundTrip(self): """Reads a wav file, writes it, and compares them.""" with self.test_session(): - path = os.path.join( - resource_loader.get_data_files_path(), 'testdata/mono_10khz.wav') + path = os.path.join(resource_loader.get_data_files_path(), + 'testdata/mono_10khz.wav') with open(path, 'rb') as f: original_contents = f.read() audio_op = ffmpeg.decode_audio( - original_contents, file_format='wav', samples_per_second=10000, + original_contents, + file_format='wav', + samples_per_second=10000, channel_count=1) encode_op = ffmpeg.encode_audio( audio_op, file_format='wav', samples_per_second=10000) @@ -68,4 +68,4 @@ class EncodeAudioOpTest(tf.test.TestCase): if __name__ == '__main__': - tf.test.main() + test.main() |