MCPcopy
hub / github.com/ibab/tensorflow-wavenet / testEncodePrecomputed

Method testEncodePrecomputed

test/test_mu_law.py:113–124  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

111 self.assertEqual(len(np.unique(encoded)), channels)
112
113 def testEncodePrecomputed(self):
114 channels = 256
115 number_of_samples = 10
116 x = np.array([-1.0, 1.0, 0.6, -0.25, 0.01,
117 0.33, -0.9999, 0.42, 0.1, -0.45]).astype(np.float32)
118 encoded_manual = np.array([0, 255, 243, 32, 157,
119 230, 0, 235, 203, 18]).astype(np.int32)
120
121 with self.test_session() as sess:
122 encoded = sess.run(mu_law_encode(x, channels))
123
124 self.assertAllEqual(encoded_manual, encoded)
125
126 def testEncodeUniformRandomNoise(self):
127 np.random.seed(42) # For repeatability of test.

Callers

nothing calls this directly

Calls 1

mu_law_encodeFunction · 0.90

Tested by

no test coverage detected