def testCompare(self): ref_env = CPUEnvironment() for shape, dtype, batch in self.testcases: data = getTestArray(shape, dtype, batch) plan = createFFTPlan(self.env, shape, dtype) ref_plan = createFFTPlan(ref_env, shape, dtype) d_data = self.env.toDevice(data) d_temp = self.env.allocate(data.shape, dtype) ref_data = ref_env.toDevice(data) ref_temp = ref_env.allocate(data.shape, dtype) plan.execute(d_data, d_temp, batch=batch) ref_plan.execute(ref_data, ref_temp, batch=batch) self.assert_(diff(self.env.fromDevice(d_temp), ref_env.fromDevice(ref_temp)) < 1e-6)
def testForwardInverse(self): for shape, dtype, batch in self.testcases: data = getTestArray(shape, dtype, batch) plan = createFFTPlan(self.env, shape, dtype) d_data = self.env.toDevice(data) d_transformed = self.env.allocate(data.shape, dtype) d_back = self.env.allocate(data.shape, dtype) plan.execute(d_data, d_transformed, batch=batch) plan.execute(d_transformed, d_back, batch=batch, inverse=True) back = self.env.fromDevice(d_back) print diff(data, back) self.assert_(diff(data, back) < 1e-6)