(self, inner_dims, complex_to_input, input_to_expected,
tf_method)
| 60 | class FFTTest(xla_test.XLATestCase): |
| 61 | |
| 62 | def _VerifyFftMethod(self, inner_dims, complex_to_input, input_to_expected, |
| 63 | tf_method): |
| 64 | for indims in inner_dims: |
| 65 | print("nfft =", indims) |
| 66 | shape = BATCH_DIMS + indims |
| 67 | data = np.arange(np.prod(shape) * 2) / np.prod(indims) |
| 68 | np.random.seed(123) |
| 69 | np.random.shuffle(data) |
| 70 | data = np.reshape(data.astype(np.float32).view(np.complex64), shape) |
| 71 | data = to_32bit(complex_to_input(data)) |
| 72 | expected = to_32bit(input_to_expected(data)) |
| 73 | with self.session() as sess: |
| 74 | with self.test_scope(): |
| 75 | ph = array_ops.placeholder( |
| 76 | dtypes.as_dtype(data.dtype), shape=data.shape) |
| 77 | out = tf_method(ph) |
| 78 | value = sess.run(out, {ph: data}) |
| 79 | self.assertAllClose(expected, value, rtol=RTOL, atol=ATOL) |
| 80 | |
| 81 | def testContribSignalSTFT(self): |
| 82 | ws = 512 |
no test coverage detected