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

Method testMinMaxRange

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

Source from the content-addressed store, hash-verified

51 self.assertAllEqual(x, round_tripped)
52
53 def testMinMaxRange(self):
54 # Generate every possible quantized level.
55 x = np.array(range(QUANT_LEVELS), dtype=np.int)
56
57 # Decode back into float scalars.
58 with self.test_session() as sess:
59 # Decode into floating-point scalar.
60 decoded = mu_law_decode(x, QUANT_LEVELS)
61 all_scalars = sess.run(decoded)
62
63 # Our range should be exactly [-1,1].
64 max_val = np.max(all_scalars)
65 min_val = np.min(all_scalars)
66 EPSILON = 1e-10
67 self.assertNear(max_val, 1.0, EPSILON)
68 self.assertNear(min_val, -1.0, EPSILON)
69
70 def testEncodeDecodeShift(self):
71 x = np.linspace(-1, 1, 1000).astype(np.float32)

Callers

nothing calls this directly

Calls 1

mu_law_decodeFunction · 0.90

Tested by

no test coverage detected