(self)
| 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) |
nothing calls this directly
no test coverage detected